can a static method be overridden
Answers were Sorted based on User's Feedback
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 |
What is the applet sandbox?
Which component handles cluster communication in jboss?
How to determine SGA site?
Which javutil classes and interfaces support event handling?
Write a program on RMI and JDBC using StoredProcedure?
what is handle?
what is difference between object state and behaviour?
Is multiple try block is possible in single java Application......
What are the design considerations while making a choice between using interface and abstract class?
whats is mean by class.forName() whats the return type of class
What class is the top of the awt event hierarchy?
How do you maintain a stateful session object across the session