Can static methods be overridden?
Answer Posted / sumit pal singh
static class Class1 {
public static int Method1(){
return 0;
}
}
static class Class2 extends Class1 {
public static int Method1(){
return 1;
}
}
public static class Main {
public static void main(String[] args){
Class1.Method1();
Class2.Method1();
}
}
| Is This Answer Correct ? | 3 Yes | 1 No |
Post New Answer View All Answers
give an example for encapsulation?
What is difference between path and classpath in java?
Is java same as core java?
Can we have two methods in a class with the same name?
What is the difference between a checked and an unchecked exception?
How many functional interfaces does java 8 have?
What is a "pure virtual" member function?
I want to persist data of objects for later use. What is the best approach to do so?
What are the Main functions of Java?
What about anonymous inner classes in java?
Difference between default and protected access specifiers?
What is ordered map in java?
How will you serialize a singleton class without violating singleton pattern?
Explain java code for recursive solution's base case?
Why is java multithreaded?