Can we override static methods?
Answer Posted / amitasite
you cannot override static method from super class.
e.g.,
class SuperType{
public static void method(){
System.out.println("Super Static");
}
}
class SubType extends SuperType{
public void method(){
System.out.println("Super Static");
}
}
It will give compilation error : Instance method cannot
override static method from SuperType
| Is This Answer Correct ? | 3 Yes | 1 No |
Post New Answer View All Answers
Can we nested try statements in java?
What is private static class in java?
What loop means?
What is the static field modifier?
Difference between final and effectively final ?
When throw keyword is used?
Is ++ operator thread-safe in java?
Which package is used for pattern matching with regular expressions?
How do you implement polymorphism in our day to day life?
Write java program to reverse string without using api?
What is Enum in Java?
What is a boolean output?
How can we make a class singleton?
What is the finalize method do?
Explain what access modifiers can be used for methods?