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


Please Help Members By Posting Answers For Below Questions

Explain about fail safe iterators in java?

661


Is java a compiler?

653


How does compareto method work?

613


How do you check if a number is a perfect square?

609


What is java autoboxing?

606






Write a program to check for a prime number in java?

649


How will you reverse a link list without using recursion?

674


What is method overloading with type promotion?

731


Is boolean a wrapper class in java?

716


Explain the selection sort algorithm?

734


What is a java lambda expression?

653


What is the use of private static?

642


What is re-factoring in software?

666


What is an object’s lock and which object’s have locks?

579


What is difference between static variable and global variable?

653