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
What are local interfaces? Describe.
What is the difference between the string and stringbuffer classes?
What are the different types of exception?
What are transaction attributes?
how to make a index.jsp for running the site in internet and find an error for connection with weblogic server and java that give an error invalid object name.and how to maintain session.
Can I have an action without a form?
what is a portable component?
What is clustering? What are the different algorithms used for clustering?
What is the purpose of the notify() method?
Why are component architectures useful?
Define the remote object implementation?
What is local interface. How values will be passed?
Which textcomponent method is used to set a textcomponent to the read-only state?
What is prototype?
Write a singleton program?