Two Laptop Bag*
The moose likes Beginning Java and the fly likes Can we override static method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Can we override static method" Watch "Can we override static method" New topic
Author

Can we override static method

Pawan M
Greenhorn

Joined: Feb 23, 2008
Posts: 3
Hi,
I was reading queries posted by other so i got one doubt due to following sentences that
"You can "override" a non-final static method, although this is actually redefining it and hiding the original method."

but what i know that we can not override static method.
Am i correct or not,please clear my doubt? i have also created one program
but i am getting output-Overriden Meth
but in case of overriding it should print- Overriding Meth
Ravikanth kolli
Ranch Hand

Joined: Feb 10, 2008
Posts: 179

Static method cannot be overridden in java.
Detailed explanation is given at

Overriding Vs Hiding

Thanks
hope that helps


-kolli
Pawan M
Greenhorn

Joined: Feb 23, 2008
Posts: 3
Thank You very much.
Now i understood.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37936
    
  22
Welcome to the Ranch, "Pawan M," but please alter your displayed name to conform to the Ranch naming policy.
Abdul Aatif
Greenhorn

Joined: Feb 08, 2012
Posts: 23
Ravikanth kolli wrote:Static method cannot be overridden in java.
Detailed explanation is given at

Overriding Vs Hiding

Thanks
hope that helps



thank you very much
 
 
subject: Can we override static method
 
Similar Threads
Generics doubt
can we overriding static method
Small OO doubt
doubt var arg
Doubt in Overloading