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 we can't do in jdbc but can do hibernate?
what is the Scope of Final Keyword in Java?
What is meant by method chaining?
What is the need of serialize?
Why is main purpose of XML?
What are the high-level thread states?
What are the JSP implicit objects ?
Why use POJO when I can use hashmap
String is immutable.it is true String can be change to mutable How?
6 Answers IBM, Professional Access, TCS,
What is a clone?
What are the types of scaling?
which type of objects reference will be given to client?