• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doubt : class defined inside an interface

 
Pankaja Shinde
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mock Exam question

Which of the following are true about the class defined inside an interface

1. it is not possible in the java Laungage.
2. The class is always public.
3. The class is always static.
4. the class methods cannot call the methods declared in the interface.
5. the class methods can call only the static methods declared in the interface.

Answer 2 3 4

I think answer should be 3 & 5.

Please explain me

Pankaj Shinde
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pankaja,

Interfaces can't have any methods declared as static. So innerclasses declared inside interface ,accessing static methods is not possible at all.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic