This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes class inside interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "class inside interface" Watch "class inside interface" New topic

class inside interface

kanchan chaudhary

Joined: Jun 06, 2001
Posts: 28
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
Angela Lamb
Ranch Hand

Joined: Feb 22, 2001
Posts: 156
1. False - it is possible. See JLS section 9.1.3.
2. True - according to JLS, "all interface members are implicitly public."
3. True
4. True - since the class is static, it can't make calls to non-static methods.
5. False - static methods may not be declared in an interface.
I agree. Here's the link:
subject: class inside interface
jQuery in Action, 3rd edition