aspose file tools*
The moose likes Beginning Java and the fly likes why fields can't be overidden????? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "why fields can Watch "why fields can New topic
Author

why fields can't be overidden?????

rahul mehra
Ranch Hand

Joined: Aug 20, 2007
Posts: 33
why fields of superclass can't be overidden??? by a subclass


Thanks
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
The answer to this question, as to so many "why" questions, is "because the Java Language Specification says so".

Overriding is to do with run-time polymorphism. The Java language only implements run-time polymorphism for instance methods, not for fields or static methods. That's a choice the language designers made. They could have chosen differently, though in this case I think they chose well.


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why fields can't be overidden?????
 
Similar Threads
Calling Overridden methods and overshadowed variables
Why Static is allowed with Final
Calling Overridden methods and overshadowed variables
static methods can't be overidden why
Why it is illegal to use abstract and static modifiers together in method declaration ?