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
Difference between hashmap and hashtable?
What is the difference between RMI registry and OS Agent?
Why won’t the jvm terminate when I close all the application windows?
Why does the option tag render selected=selected instead of just selected?
What value does read() return when it has reached the end of a file?
what are getters and setters in Java with examples?
What is metaspace?
Do I have to use jsps with my application?
What is the diffrence between a local-tx-datasource and a xa-datasource? Can you use transactions in both?
What is the difference between a menuitem and a checkboxmenuitem?
when A client sent a request to the server to open facebook page and close the browser after this request .at that time the same user do login by using a different browser then that session id will exist or not for the same client??
Can I import same package/class twice? Will the jvm load the package twice at runtime?
Which container method is used to cause a container to be laid out and redisplayed?
what is a non-repeatable read?
What are the purpose of introspection?