It's not a secret anymore!*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes incorrect question in roundup Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "incorrect question in roundup" Watch "incorrect question in roundup" New topic
Author

incorrect question in roundup

Swamy Nathan
Ranch Hand

Joined: May 16, 2004
Posts: 187
I was doing this roundup
roundup game

A)#136 True or False:
An inner class has free access to private member data of the outer classes.


I chose false thinking-
Its possible the inner class is a anonymous or local inner class declared in a static context. In which case the inner class cannot have access to non-static member data of outer class

The roundup gave the answer true.
So am I right in my thinking that the answer is incorrect o the question could be worded more clearly?
More important will such a problem happen in the actual test?

B)After the game is over and I chose to have another go it opened up to #127.
But the question showed only the radio button for yes.
It did not show the done button.
[ June 06, 2004: Message edited by: Swamy Nathan ]
Gian Franco
blacksmith
Ranch Hand

Joined: Dec 16, 2003
Posts: 977
Hi,

I believe it's a matter of terminology. An inner
class is never static. If the given class has the
static modifier then it should be called a nested
class and not an inner class. I think that's why
the roundup game expects the suggested answer.

Cheers,

Gian Franco


"Eppur si muove!"
Swamy Nathan
Ranch Hand

Joined: May 16, 2004
Posts: 187

chose false thinking-
Its possible the inner class is a anonymous or local inner class declared in a static context. In which case the inner class cannot have access to non-static member data of outer class

The roundup gave the answer true.



Static context here means when the local class or anonymous class is declared/defined /used inside a static method or a static initializer body.
In such a case the inner class does not have access to the "instance" members of the outer class.

So I think the roundup question was wrong
SCJP
[ June 06, 2004: Message edited by: Swamy Nathan ]
Gian Franco
blacksmith
Ranch Hand

Joined: Dec 16, 2003
Posts: 977
Hi,

SCJP


???

If you define the class in a static initializer
block or inside a static method, then you will
get a (method) local inner class. Which has,
amongst other things, consequences in the way
it can be instantiated, the variables it can
call, etc...

And to quote K&B


A "regular" inner class is declared inside the
curly braces of another class, but outside any
method or other code block.


Ciao,

Gian Franco
[ June 06, 2004: Message edited by: Gian Franco Casula ]
Swamy Nathan
Ranch Hand

Joined: May 16, 2004
Posts: 187
SCJP


Hey to quote from Khalid's book

In addition to the top-level classes and interfaces, there are four categories of nested classes and one of nested interfaces, defined by the context these classes and interfaces are declared in:

a-static member lasses and interfaces
b-non static member classes
c-local classes
d-anonymous classes

The last three categories are collectively known as inner classes. They differ from non-inner-classes in one important aspect athat an instance of an inner class may be associated with an instance of the enclosing class.


So there! who do i believe?
Am I right that the question is wrong?
Would the actual exam have such problems?
SCJP

[ June 06, 2004: Message edited by: Swamy Nathan ]
Gian Franco
blacksmith
Ranch Hand

Joined: Dec 16, 2003
Posts: 977
Hi Swamy,

(I still don't get your " SCJP")...anyway
when it comes to the exam the formulation of the
question will be unambiguous.

I posted a similar question with regards to the
status of threads which is ambiguous in a lot of
mocks.

Bye,

Gian Franco
[ June 07, 2004: Message edited by: Gian Franco Casula ]
Swamy Nathan
Ranch Hand

Joined: May 16, 2004
Posts: 187
is just a lil humour shows me banging my head at the mock tests and working my way to the real one. thats all.
maybe i shd keep the humour down a bit if u ppl mind.
hope no one found it an issue.
sorry if it bothered anyone.
its just that u get carried away once in a while because of all that cofee. when u are busy studying for the exam and ur girl friend does not understand why u prefer the computer to her. so u take out ur steam i guess.
my apologies once again
Gian Franco
blacksmith
Ranch Hand

Joined: Dec 16, 2003
Posts: 977
Hi,

No problem I just didn't expect there would be
any coffee left after my preparation: I drank lots
myself.

Good luck with your preparation.

Gian Franco
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
Don't bang your head too hard or you'll have a blinding headache the day of the exam.
If you then take painkillers they could disqualify you for substance abuse, like they do with Olympic sporters


42
Swamy Nathan
Ranch Hand

Joined: May 16, 2004
Posts: 187
Thats very true I guess I have heard of guys who didnt sleep properly and did badly or guys who took the exam too seriously.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: incorrect question in roundup