This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes doubt in interface?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "doubt in interface??" Watch "doubt in interface??" New topic
Author

doubt in interface??

srikanth reddy
Ranch Hand

Joined: Jul 28, 2005
Posts: 252


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

thanks
sri


Thanks & Regards<br /> <br />-Srikanth
Thomas Drew
Ranch Hand

Joined: Sep 15, 2004
Posts: 47
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.
 
Don't get me started about those stupid light bulbs.
 
subject: doubt in interface??
 
Similar Threads
class defined inside an interface
class inside interface
class in interface!
Interface??
interface