This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Rule Round-up Game Question #108 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Rule Round-up Game Question #108" Watch "Rule Round-up Game Question #108" New topic
Author

Rule Round-up Game Question #108

Igor Stojanovic
Ranch Hand

Joined: Feb 18, 2005
Posts: 58
Hi,

I got confused when question #108 pop up:


They say that correct answer is 4,
doStuff() from B class gets called...

I dont understand why this should be,
if we declare doStuff() method to be static then correct answer would be 3.,
doStuff() from A class would be called...
they didnt say if method doStuff() was declared with default acces modifier or with static so I think that question should be more specific about acces modifier , plz correct me if I am thinking wrong


kind regard
Igor
[ February 19, 2005: Message edited by: Igor Stojanovic ]
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
The question states that "B overrides the doStuff() method inherited from A." To me, this implies that doStuff() is NOT static because if it was then B couldn't override it.

Layne


Java API Documentation
The Java Tutorial
Igor Stojanovic
Ranch Hand

Joined: Feb 18, 2005
Posts: 58
Thx for quick answer I should learn english better first then java (english is my 3rd language)




kind regards
Igor
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
For the record, the question could be stated much more clearly by giving the code for class A and class B. In fact, if the code includes System.output.println() calls, the question could just ask what the output of the program would be.

And I would have never guessed that English is not your native language. You write very clearly and with correct grammar.

Layne
[ February 19, 2005: Message edited by: Layne Lund ]
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
There is not much space to ask a question in the Rule Roundup game. Not enough space to give the code for class A and class B.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
It wouldn't take much room:

Well...maybe that wouldn't fit in the available space...hmm...

Layne
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Rule Round-up Game Question #108
 
Similar Threads
K&B Static Method Redifinition Problem..
Threads
Doubt related to Generics Question
Gotcha: Varargs spoofs method signature [from Sierra/Bates book]
java