InterviewSolution
| 1. |
Can We Override Static Method In Java? |
|
Answer» No, you cannot override a STATIC method in Java because it's resolved at compile TIME. In order for overriding to work, a method should be virtual and resolved at runtime because objects are only AVAILABLE at runtime. This is one of the tricky Java questions, where interviewer tries to confuse you. A PROGRAMMER is NEVER sure about whether they can override or overload a static method in Java. No, you cannot override a static method in Java because it's resolved at compile time. In order for overriding to work, a method should be virtual and resolved at runtime because objects are only available at runtime. This is one of the tricky Java questions, where interviewer tries to confuse you. A programmer is never sure about whether they can override or overload a static method in Java. |
|