can a static method be overridden
Answer Posted / vivek
If a subclass defines a static method with the same signature as a static method in the superclass, the method in the subclass hides the one in the superclass. The distinction between hiding and overriding has important implications.
public class Animal
{
public static void hide()
{
System.out.format("The hide method in Animal.");
}
public void override()
{
System.out.format("The override method in Animal.");
}
}
public class Cat extends Animal
{
public static void hide()
{
System.out.format("The hide method in Cat.");
}
public void override()
{
System.out.format("The override method in Cat.");
}
}
But still I am not convinced with the exact difference in between hiding and overriding a method...???
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What are the types of scaling?
What is the difference between the session.get() method and the session.load() method?
In inglish: How to convert jar to exe files? Em português: Como converter arquivos .jar para .exe?
What is in-memory replication?
Explain the steps in details to load the server object dynamically?
When a thread blocks on i/o, what state does it enter?
What is ripple effect?
What is the immediate superclass of the applet class?
What are the services in RMI ?
What is ioc concept & explain it?
Name three subclasses of the component class?
whats is statement and procedure
Difference between loadclass and class.forname?
Describe activation process?
What is the purpose of the wait(), notify(), and notifyall() methods?