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
cud u help me ... i am struggling with this question... to find all the subsets of a given set for ex.... a,,b,c shud give all the subsets.... i gt the program in c bt nt able to get it in java..... help needed ..
Describe, in general, how java's garbage collector works?
What is a class loader?
What value does readline() return when it has reached the end of a file?
What do you know about seam?
In RMI, inorder to sent the stub reference to the client, is we have to load the server object first into the memory or can we directly sent reference to the client?
For which statements does it make sense to use a label?
Do I have to use jsps with my application?
which book is better for jdbc ,servlets and jsp
How can I scroll through list of pages like the search results in google?
What are the different algorithms used for clustering?
Why are component architectures useful?
Can I import same package/class twice? Will the jvm load the package twice at runtime?
How will you pass parameters in RMI? Why do you serialize?
How to deploy Jar, War files in J2EE?