This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Wat will happen, If I declare static final method in super class and redefine same method in sub class... Sub-class can define same prototype which will be a different method all together and it will also hide the super class static method.
In above code, If I compile, It will give compilation error.... Method declare at line 1 is final.. At line 2, its a totally different method, its not overriden becoz of static declaration at line 1.
hi, final methods can not be visible to the childs classes. In this case..the method f() is not visible to the child class... if u remove the finla keyword from the parent class....it is nth but 'hiding' not 'overriding' b'coz f() is static...for this to happen..the method in the parent class should be visble to the child class....unless it is visible how can the compiler recognise it whether it is overriding or hiding??
For static methods there is a concept of hidding not method overridding.For hidding also it is necessary to follow all conditions that we follow for method overriding like return type,type and number of parameters,exceptions in throws clause.
in your example you declared method as final,for static or non static, final methods should not be overridden.