File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Head First Android this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Local class " Watch "Local class " New topic

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?
[ November 06, 2003: Message edited by: Cathy Song ]
Harwinder Bhatia
Ranch Hand

Joined: Oct 17, 2003
Posts: 150
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
Cathy Song
Ranch Hand

Joined: Aug 24, 2003
Posts: 270
jQuery in Action, 3rd edition
subject: Local class
It's not a secret anymore!