This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
class A{ final static void AMethod() {}//final static method } abstract class An extends A { public static void AMethod() {} /* static method is not overriden,it is hidden */ } Then why does this code not compile? Someone from this forum only said that static method are not overriden,they are just hidden.
Corey McGlone
Ranch Hand
Joined: Dec 20, 2001
Posts: 3271
posted
0
You're right, static methods are not overridden, they are hidden. But, from the JLS, §8.4.3.3 final Methods:
A method can be declared final to prevent subclasses from overriding or hiding it. It is a compile-time error to attempt to override or hide a final method.
Don't forget the second part of that statament. Corey