File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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
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?????