• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

doubt in interface??

 
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


so the class which is declared inside aninteface is behaving like an member variable ??

thanks
sri
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
srikanth
I could not find any examples of a class created inside an interface. I used the code below to see how it would work. Prehaps someone else has more insight into this.



this code compiled and ran fine . So for your questions :
1)it is not possible in the java Laungage.
false, I was able to implement the class in the interface.

2)The class is always public.
not sure but I thank the answer is true
3)The class is always static.
false
4)the class methods cannot call the methods declared in the interface.
false

5)the class methods can call only the static methods declared in the interface
false


another problem I had with the class in the interface is that the tryit method could not be declared abstract. I assumed the class it self would be abstract since it was in the interface but trying to set the methods in the class to abstract generated an error.

hope this help.
 
It's hard to fight evil. The little things, like a nice sandwich, really helps. Right tiny ad?
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic