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 Examulator doubt on inner classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Examulator doubt on inner classes" Watch "Examulator doubt on inner classes" New topic

Examulator doubt on inner classes

Burkhard Hassel
Ranch Hand

Joined: Aug 25, 2006
Posts: 1274
Hi ranchers,

I know, Marcus Green has an own discussion group about his questions.
But today Christie Thom posted here

that she passed the exam.

And further:
Actually I am surprised that I got lot of questions from inner classes I can't remember exactly but almost 10 questions.

So I post this inner class question here.
In the question of today (question #99)

about method local inner classes the question was:
Which of the following statements are true of a method local inner class?

the correct answer given was
1) It has access to all members of its enclosing class
2) It can only access final variables of its enclosing method

I think that answer 1 is false. If the method (where the inner class is in) is static, the inner class has no access to non-static members of the enclosing class. So we can't say it has access to all members.

Any comments // on that?


all events occur in real time
Marcus Green
arch rival

Joined: Sep 14, 1999
Posts: 2813
Could you post some code that illustrates this?

SCWCD: Online Course, 50,000+ words and 200+ questions
Burkhard Hassel
Ranch Hand

Joined: Aug 25, 2006
Posts: 1274
Sure, here's an example

The error is the classic one: "Cannot make a static reference ...".

I agree. Here's the link:
subject: Examulator doubt on inner classes
It's not a secret anymore!