can a static method be overridden

Answers were Sorted based on User's Feedback



can a static method be overridden ..

Answer / aswini de

public class Test extends Test2{

public static void main(String args[]){
String str="";
int b=Test.cal(4);
System.out.println(b);
Test t =new Test();
t.displayX();
}

public static int cal(int a){
int b=a*a;
return b;
}

}

public class Test2 {
public static void main(String args[]){

}

public static int cal(int a,int b){
int c=a*b;
System.out.println("IN Super orerriden
methods:");
return c;
}

public void displayX(){
System.out.println("HI i am in Super");
}

}
my Sub Class is Test extends Test2 Class
Common static method is cal()

its run properly. No compile error , NO runtime error

Is This Answer Correct ?    4 Yes 38 No

Post New Answer

More Advanced Java Interview Questions

What is a sessionfactory? Is it a thread-safe object?

0 Answers  


Difference between DurableSubscription and non- DurableSubscription?

0 Answers  


What is a tasks priority and how is it used in scheduling?

0 Answers  


What is the form of storage space in java?

0 Answers  


What is source and listener?

1 Answers  






What is ripple effect?

0 Answers  


What is colon_pkg_prefixes and what is its use?

0 Answers  


What is message driven beam?

0 Answers  


How can I avoid validating a form before data is entered?

0 Answers  


How do you set security in applets?

1 Answers   IBM,


What is daemon thread?

3 Answers  


In real time project when will we use Abstract class. and what are the difference between abstract and interface.

6 Answers   DELL, FCS, Polaris, Tanla Solutions, TCS,


Categories