aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Need clearification Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Need clearification" Watch "Need clearification" New topic
Author

Need clearification

Muhammad Saghir
Greenhorn

Joined: Mar 06, 2002
Posts: 6
Hello All
I have one confusion while i was doing Mercus Green Mock Exam #3.In question no.17 and 48 he says that "static methods may not/ cannot be overridden to be non-static" and in one of the answers it is correct.
But in kahlid azim mughal's book he says "private ,static and final methods cannot be overriden".
can someone clearify this point.
thanks


Saghir SCJP2
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
Saghir,
Welcome to Javaranch
Static method cannot be overridden because static methods are not inherited. Static methods can be hidden, though, which means that you may have two static methods with the same signature in the superclass and in the subclass.
Moreover, it is illegal (as per JLS 8.4.6 Inheritance, Overriding, and Hiding ) to hide a static method with a non-static method. Also, it is illegal to override a non-static method with a static method.
Please, read the Javaranch Naming Policy and change your publicly displayed name to comply with our unique rule. Thank you for your cooperation.
[ March 06, 2002: Message edited by: Valentin Crettaz ]

SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need clearification