can a static method be overridden
Answer Posted / 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 View All Answers
If we opened Windows Internet Explorer 4 times, does it starts 4 processes or 4 threads?
When a thread blocks on i/o, what state does it enter?
What value does read() return when it has reached the end of a file?
What are the difference between RMI and CORBA?
Why does the option tag render selected=selected instead of just selected?
what is meant by JRMP?
whats is mean by connectionpooling
Why do I get a duplicate name error when loading a jar file?
What is Remote Server?
What is ioc concept?
how to use debug in my elipse to solve problems that exist in my project
What are local interfaces? Describe.
Are enterprise beans allowed to use thread.sleep()?
What is the difference between the font and fontmetrics classes?
What is threadfactory?