• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Marcus Q (inner class)

 
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Which of the following statements are true
1) An inner class may be defined as static
2) There are NO circumstances where an inner class may be defined as private
3) A programmer may only provide one constructor for an anonymous class
4) An inner class may extend another class


Answers: 1,4
I think answer should be ONLY 4. According to K&B book there is nothing like STATIC inner class. There are static top level nested classes.
How should we approach such questions on the exam?
Thanks.
 
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Cathy. It seems that people who learned Java before the second edition of the JLS called any nested class an inner class, both static and non-static.
This was my strategy.
1. Be prepared � just in case there is a question on the exam that never got upgraded. Decide in advance how you are going to handle this.
2. If I encountered a question on the exam using "static inner", I would answer correctly according to the JLS second edition � inner classes are never static. After the exam, I would discuss this with Sun and request that my answer to the question be reevaluated.
We all worry so much, you, me, Vad about ambiguous questions. As it turns out, on my exam, all of the questions were very clear and unambiguous. I hope it will be the same for you.
[ November 09, 2003: Message edited by: Marlene Miller ]
 
Marlene Miller
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On the other hand... if you search the forum for static inner and member 37766 (Kathy Sierra), you will see what Kathy says. For example, Here
So an alternative strategy, which I think follows Kathy's advice, is, if you see the strange term static inner, assume this means static nested.
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems that people who learned Java before the second edition of the JLS called any nested class an inner class, both static and non-static.
Which is unfortunate since even the Inner Classes Specification used the same definition - a static nested class is not an inner class, period. Of course, the fact that Sun called the document the Inner Classes Specification even though it also described static nested classes, may give an idea of the sort of mixed signals Sun was sending back then. :roll:
Anyway, long ago there were reputedly one or two questions that referred to a "static inner class", without giving you an opportunity to say "does not exist" as your answer. So it was clear from the context that you were supposed to just accept their terminology and assume they realy mean static nested. It was wrong, but easy to figure out given the context. Nowadays though, it's been a long time since any problems like that were reported, so you probably shouldn't worry much about it.
 
Cathy Song
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Marlene and Jim.
Your comments were very helpful.
 
Marlene Miller
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cathy, here is something that happened to me � 3 times � when I took the exam.
I read a question and *more* options were correct than the number to select. I thought � this exam has bugs.
Each time, I took a mental break, then reread the question saying why each option is correct or not. It turns out, I was mistaken.
One time I marked the question. After finishing the exam, I went back to that one question, and found that I was mistaken.
 
Cathy Song
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the tip Marlene.
reply
    Bookmark Topic Watch Topic
  • New Topic