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
Why use a datasource when you can directly specify a connection details? (in a J2EE application)
Explain what is orm?
why static class in java
What is Remote Server?
Is it possible to stop the execution of a method before completion in a sessionbean?
How task's priority is used in scheduling?
Name the eight primitive java types.
what is a non-repeatable read?
What is the diffrence between a local-tx-datasource and a xa-datasource?
Do I have to use jsps with my application?
what are memory considerations of jsp compares to other web components?
Java is fully object oriented languages or not?
Why is actionform a base class rather than an interface?
What is message driven beam?
Write a program to show synchronization?