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


Please Help Members By Posting Answers For Below Questions

What is a nested list?

524


What is your platform?s default character encoding and how to know this?

1754


Can java list be null?

558


Explain the overview of UDP messaging.

737


Will the jvm load the package twice at runtime?

578






Is sizeof a keyword in java programming?

614


Does constructor return any value?

585


What is string syntax?

553


What restrictions are placed on method overloading in java programming?

578


why would you use a synchronized block vs. Synchronized method? : Java thread

537


Can we sort a map in java?

578


What are the types of relation?

577


what r advatages of websphere? & how to deploy?

1641


What is a line separator in java?

543


how can you take care of mutual exclusion using java threads? : Java thread

615