hepla
hopla
hoplaboum
hoplaboum
In the SCJP 6 exam preparation book it is said (page 107) that "you can't override a method marked static"
So is that something new that came with java 6, or did I misunderstand something from the book???
Using super to invoke an overriden method only applies to instance methods
Originally posted by Meera:
You cannot invoke a static method using an instance as it belongs to the class.
Originally posted by Abhi:
But in this case we are using super.hopla to invoke a static method, why is it giving the correct answer then?
Quoting the JLS, "A hidden method can be accessed by using a qualified name or by using a method invocation expression (�15.12) that contains the keyword super or a cast to a superclass type. In this respect, hiding of methods is similar to hiding of fields"
thanks
Harvinder
Don't get me started about those stupid light bulbs. |