This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes answer please Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "answer please" Watch "answer please" New topic
Author

answer please

josephine chen
Ranch Hand

Joined: Oct 29, 2002
Posts: 216
13)
Which of the following statements is true?
a) An interface can contain a nested top-level inner class.
b) An interface can contain a member inner class.
c) A member inner class can implement an interface.
d) A static method can contain a local class.
e) A static method can contain a nested top-level class.
is it c) and d) only.
Roll
Ranch Hand

Joined: Jan 20, 2000
Posts: 52
You are right shan, its c) and d).
a) is incorrect because interface contains nested top level class.
b)is incorrect.Because,Look a).
c)correct
d)correct
e)is incorrcect because of d)
Tony Alicea
Desperado
Sheriff

Joined: Jan 30, 2000
Posts: 3222
    
    5
<PRE>
Which of the following statements is true?
 
a) An interface can contain a nested top-level inner class.
YES
 
b) An interface can contain a member inner class.
NOPE. Even without the static keyword it will be assumed to be static.
 
c) A member inner class can implement an interface.
TRUE
 
d) A static method can contain a local class.
TRUE. That type of class can be in any type of method.
 
e) A static method can contain a nested top-level class.
NO!! Methods can only have LOCAL classes.
 
is it c) and d) only.
</PRE>

Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944

Tony, can you please tell me what are top-level inner classes and top-level classes
Tony Alicea
Desperado
Sheriff

Joined: Jan 30, 2000
Posts: 3222
    
    5
Nested classes are classes defined inside other classes. This was new with Java 1.1. What book are you using to prepare? This subject is kind of 'heavy' and it's better to read something about it first. The SUN specification is in:
http://java.sun.com/products/jdk/1.1/docs/guide/innerclasses/spec/innerclasses.doc.html
Let us know...
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
are nested toplevel classes and static inner classes the same??
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Yes. Different authors use the both terms, and Sun is not really consistent either. It's a mess.


"I'm not back." - Bill Harding, Twister
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
thanks,jim
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: answer please
 
Similar Threads
inner class
innerclass question
Nested class/interface doubt
Ques already asked by Roll!!!
Inner class concept