can a static method be overridden
Answer Posted / kiran sangeri
no,bcos look at below code
package test;
class A {
static void something () {
System.out.println("class A");
}
}
class B extends A {
static void something () {
System.out.println("class B");
}
}
public class ClassC {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
A anA = new B ();
anA.something ();
}
}
Output : class A
so Class A is not been overridden.
| Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
Is there a guarantee of uniqueness for entity beans?
What is prototype?
Can I import same package/class twice? Will the jvm load the package twice at runtime?
What is Stream Tokenizer?
Write a singleton program?
what is a non-repeatable read?
What is re-entrant. Is session beans reentrant. Is entity beans reentrant?
What’s jboss cache in short?
What is the difference between long.class and long.type?
What is in-memory replication?
If your ui seems to freeze periodically, what might be a likely reason?
How task's priority is used in scheduling?
How to deploy Jar, War files in J2EE?
wahts is mean by dynavalidatorform in struts/
What do you know about seam?