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
Difference between loadclass and class.forname?
Why use POJO when I can use hashmap
Define aop(assepct oriented programing)?
When a thread blocks on i/o, what state does it enter?
when A client sent a request to the server to open facebook page and close the browser after this request .at that time the same user do login by using a different browser then that session id will exist or not for the same client??
What is the difference between the ‘font’ and ‘fontmetrics’ class?
Can I map more than one table in a cmp?
How to determine SGA site?
What are the services in RMI ?
What restrictions are placed on the values of each case of a switch statement?
What’s jboss cache in short?
Which container method is used to cause a container to be laid out and redisplayed?
What is in-memory replication?
whats is statement and procedure
Difference between swing and awt?