+ 2

Why the program is showing errors

interface MyInterfaceA {        void display();      interface MyInterfaceB { void myMethod();        }  }         class NestedInterfaceDemo1 implements MyInterfaceA.MyInterfaceB {        public void myMethod(){          System.out.println("Nested interface method");      }               public static void main(String args[]){            MyInterfaceA.MyInterfaceB obj= new NestedInterfaceDemo1();       obj.myMethod();        }   }

27th Mar 2020, 8:19 AM
🎶💞Sravs💞🥀
🎶💞Sravs💞🥀 - avatar
5 Réponses
+ 5
Can you write this program in Sololearn Playground and share here?
27th Mar 2020, 8:53 AM
A͢J
A͢J - avatar
+ 4
Kontham Shravani interface declaration is wrong. You have to implement multiple interface with comma not with dot. No need to create object of interface.
28th May 2020, 1:24 PM
A͢J
A͢J - avatar
+ 2
Kontham Shravani When I copied your code in Play Ground and run that then I got error of white space character. Compare your code with this and see what you did mistake. ---------------- interface MyInterfaceA { void display(); } interface MyInterfaceB { void show(); } class Demo implements MyInterfaceA, MyInterfaceB { public void display () { System.out.println("My interface A"); } public void show() { System.out.println("My interface B"); } public static void main(String[] args) { Demo d = new Demo(); d.display(); d.show(); } }
28th May 2020, 1:58 PM
A͢J
A͢J - avatar
+ 1
Give me the proper answer in which line I have to remove white space .I can't understand what did you say
28th May 2020, 1:20 PM
🎶💞Sravs💞🥀
🎶💞Sravs💞🥀 - avatar
0
Run the program, you can understand that your program has some extra white-space characters. Remove those, then it works. Edit: Kontham Shravani Sry for late response.. Is it resolved? Nested interface? There Whice space means : Complier shows you error at line number: illegal charecter like \u00a0. Go to that line number and remove extra spaces which are there....
27th Mar 2020, 9:29 AM
Jayakrishna 🇮🇳