This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Java in General and the fly likes override Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "override " Watch "override " New topic
Author

override

eswar kumar
Ranch Hand

Joined: Oct 20, 2002
Posts: 98
why cant we override static methods?
Chandra Sekhar
Ranch Hand

Joined: Sep 26, 2003
Posts: 90
Hi,
You can only hide static methods,but not override them.A sub class cannot override a "class" method.A sub class can hide a static method in super class by declaring a static method in the subclass with the same signature as the static mathod in the super class.
At compilation time, the compiler matches the static method to the class referenced at compile time. It does not match it to the class used at runtime.
Chandrasekhar S.
SCJP
[ November 28, 2003: Message edited by: Chandrasekhar S ]

"Luck is when opportunity meets preparation"
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: override
 
Similar Threads
Moving object on keyEvents FAILING !
Overriding
Equals and Hashcode
generics problem
override