File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Why is this wrong? 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 "Why is this wrong?" Watch "Why is this wrong?" New topic
Author

Why is this wrong?

Tony Sam
Ranch Hand

Joined: Nov 19, 2001
Posts: 32
"Static methods can be overridden by static methods only. " is Wrong, why is "Static methods cannt be overridden by non-static methods" correct ?
i dont understand it, hope someone helps!!

Tony Sam<BR>One want to be a SCJP...
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5370
Originally posted by Tony Sam:

why is "Static methods cannt be overridden by non-static methods" correct ?
Because compiler won't allow you.
"Static methods can be overridden by static methods only. " is Wrong.
Because static methods are hidden not overridden.
HTH
CMIW

------------------
Regards
Ravish


"Thanks to Indian media who has over the period of time swiped out intellectual taste from mass Indian population." - Chetan Parekh
amit mawkin
Ranch Hand

Joined: Oct 31, 2001
Posts: 73
I agree with ravish static methods are hidden and are not overridden in subclasses
------------------
coffee drinker
-----------------------
Sun Certified Programmer for Java 2 Platform


regards, Amit
coffee drinker and Sun Certified Programmer for Java 2 Platform
Jim Hall
Ranch Hand

Joined: Nov 29, 2001
Posts: 162
This question was just posted yesterday.
http://www.javaranch.com/ubb/Forum24/HTML/013653.html
Tony Sam
Ranch Hand

Joined: Nov 19, 2001
Posts: 32
Originally posted by ravish kumar:
[b]why is "Static methods cannt be overridden by non-static methods" correct ?
Because compiler won't allow you.
"Static methods can be overridden by static methods only. " is Wrong.
Because static methods are hidden not overridden.
HTH
CMIW
[/B]

i know ,just one word : "Static method are not overridden." ,
is this OK?
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
yes it is, but they are hidden instead
HIH
------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
Andre Zhang
Greenhorn

Joined: Aug 14, 2001
Posts: 9
Originally posted by Valentin Crettaz:
yes it is, but they are hidden instead

does HIDDEN mean that the static method cant be accessed by the subclass?
Karen Leoh
Ranch Hand

Joined: Dec 03, 2001
Posts: 40
The following statements are true.. but I hope someone can elaborate on them..
Static methods are never overridden. They are hidden or shadowed just like fields.
Static methods cannot be shadowed by a non-static method and vice versa.
Static method can be shadowed by a static method in the subclass.
Can anyone one please elaborate what does hidden or shadowed means? What's the difference between the two?

--------------------<p>Karen Leoh<br />Sun Certified Programmer for Java™ 2 Platform
 
Don't get me started about those stupid light bulbs.
 
subject: Why is this wrong?
 
Similar Threads
Overriding static methods
Overriding static methods
Redefining a static method in subclass
Static methods are inherited but not overriden
Static Methods