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 |
whats is mean by jndi
What are the different approaches to represent an inheritance hierarchy?
whats is mean by jndi
What is the immediate superclass of the applet class?
What happens when we invoke a thread?s interrupt method while it is in sleeping or waiting condition?
how team leaders assign work for the team member like through papers,word document
What are the different class loaders used by jvm?
how to search the pertical objects in a Collections
What class is the top of the awt event hierarchy?
What are the types of scaling?
What’s jboss jbpm?
How u validate date in DD/MM/YY format. and how u validate money in ur jsp
3 Answers Ashok Leyland, Satyam, Tech Mahindra, Tomax,