This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Local class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Local class " Watch "Local class " New topic
Author

Local class

Cathy Song
Ranch Hand

Joined: Aug 24, 2003
Posts: 270
javaCertificate Q.
-------------------
Which of the following statements are true? [Check all correct answers]
1. Local classes can access final variables and final parameters of the enclosing method and non-final member variables of the outer class.
2. A constructor cannot be defined for a anonymous class.
3. An instance of a static nested class can be created without an instance of its enclosing class.
4. None of the above.
Answers: 1,2,3.
I did not choose 1, because I thought the statement suggests that local classes can ONLY access non-final member variables of the outer class.
Does anyone else have that problem?
Thanks.
[ November 06, 2003: Message edited by: Cathy Song ]
Harwinder Bhatia
Ranch Hand

Joined: Oct 17, 2003
Posts: 150
Cathy
In my opinion, I don't think there's any problem with the question.
Option 1 doesn't say ONLY, so I would say it's an unfair assumption.
If I say "I have a cat", you can't assume that cat is the ONLY pet I have
Cheers
Harwinder
Cathy Song
Ranch Hand

Joined: Aug 24, 2003
Posts: 270
Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Local class
 
Similar Threads
INNER CLASS AGAIN~~~! So terrible
Clear Understanding of Inner Class..
"local inner classes"
the Quession about static of inner class
class types