aspose file tools*
The moose likes Java in General and the fly likes static method inheritance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "static method inheritance" Watch "static method inheritance" New topic
Author

static method inheritance

Sri In
Greenhorn

Joined: May 08, 2009
Posts: 5
Java says a static method cannot be overridden because static method is Class level method.
Then why cant the above justification apply for inheritance.Why a static method is inherited.
Please justify.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4541
    
    5

Quite simply, because the language specification says so.

The Java Language Specification: Inheritance, Overriding and Hiding


luck, db
There are no new questions, but there may be new answers.
Sri In
Greenhorn

Joined: May 08, 2009
Posts: 5
Yeah I know it is according to specification.
But I am not getting what is the reason behind that.
Can anybody help me
santhosh.R gowda
Ranch Hand

Joined: Apr 06, 2009
Posts: 296

static methods can be overridden by static method in sub class if you override in nonstatic method compiler complines you the error overridden method is static..


Creativity is nothing but Breaking Rules
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10355
    
    8

"Sri Sri"
Please check your private messages for an important administrative matter.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
santhosh.R gowda
Ranch Hand

Joined: Apr 06, 2009
Posts: 296
sorry manesh i wont repeat it another time.....
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10355
    
    8

santhosh.R gowda wrote:sorry manesh i wont repeat it another time.....


???
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874

santhosh.R gowda wrote:
static methods can be overridden by static method in sub class if you override in nonstatic method compiler complines you the error overridden method is static..


Santosh,

Its not overridden , its called hiding. OverridingVsHiding
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: static method inheritance