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

Who developed java?

558


Why do we need data serialization?

536


How many bytes is a url?

556


Name some OOPS Concepts in Java?

631


Explain the importance of finalize() method.

558






Can a class have a static inner class?

600


What is difference between string and stringbuffer?

485


Which is faster set or list in java?

520


Is null == null in java?

641


Can we have this () and super () together?

594


Can long be null in java?

538


Write a method that will remove given character from the string?

565


Can we sort set in java?

529


How to perform linear search in java?

560


Is simpledateformat safe to use in the multithreaded program?

534