wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Ques from Jxam 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 "Ques from Jxam" Watch "Ques from Jxam" New topic

Ques from Jxam

Ashish Agarwal
Ranch Hand

Joined: Dec 02, 2000
Posts: 36
Here are 2 Ques. fom JExam about which i have doubt.

Which of the following statements are true regarding inner classes.
Possible Answers:
Possible Answer 1:
Variables defined inside inner classes cannot be static.

Possible Answer 2:
Variables defined inside inner classes cannot be static unless the inner class itself is static.

Possible Answer 3:
Non-static inner classes (which are not defined in a method) have access to all class and instance variables, regardless of the access qualifier of those variables.
Possible Answer 4:
An inner class can actually be a subclass of the outer class

Possible Answer 5:
Inner classes can be declared as private. Top level, outer classes cannot.
Correct answer given is 2 whereas i think 1 is also correct as they
themselves has explained in 2.
The argument for a "case" statement must be a constant or a constant expression which can be evaluated at compile time.
Possible Answers:
Possible Answer 1:

Possible Answer 2:

Correct Answer...
Answer 1:
I think correct answer is false because constant or constant expression
should not be long float,double,boolean.They should have explicitly
mention it.
Please express your views.
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4340

question 1) i say answers 3, 4, and 5 are correct. As for answers 1 and 2, the fact is that non-static inner classes can have static members if those members are also final.
question 2) the fact that the argument for a case statement must be assignable to int does not make the statement that it must be a constant false.

Visit my download page
anjan bhushan
Ranch Hand

Joined: Dec 12, 2000
Posts: 71
ashish r u of TIL?What book u r following for inner class?

I am the most eligible bachelor in whole world, but only known in limited territory!!!
Digital Intoxication Blog
Ashish Agarwal
Ranch Hand

Joined: Dec 02, 2000
Posts: 36
Sorry for placing my Question wrong. Actually what I wanted to ask was if in Q1 choice 2 is correct than choice 1 is also true.Choice 3,4,5 are obviously true.Indeed they have given choices 2,3,4,5 as true.
Once again sorry for miscommunication.
Randall can you explain it with a example.
subject: Ques from Jxam
Similar Threads
A question from JQPlus
doubts in mock exam ques
doubts in mock exam ques
inner class static or no?