• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

incorrect question in roundup

 
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
blacksmith
Posts: 979
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Swamy Nathan
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 979
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 979
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 979
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Swamy Nathan
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic