+ 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 Answers
+ 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 šŸ‡®šŸ‡³