can a static method be overridden
Answer Posted / dheerendra
static method can be overriden the case is that in in
subclass that method should also be static.
class A {
static void something () { System.out.println("static method
in A");}
}
class B extends A {
static void something () {System.out.println("static method
in B");}
}
class TestClass{
public static void main(String args[]){
A a = new A();
B b = new B();
A.something();
B.something();
A t = new B();
t.something();
}
}
the output is
static method in A
static method in B
static method in A
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the argument type of a programs main() method?
What is RMI and what are the services in RMI?
How would you create a button with rounded edges?
Are there books about seam?
Is the infobus client side only?
Explain ioc concept?
Which javutil classes and interfaces support event handling?
Do I have to use jsps with my application?
What is Remote Server?
Should synchronization primitives be used on bean methods?
which book is better for jdbc ,servlets and jsp
What are the steps to write p-to-p model application?
What are callback interfaces?
What are the design considerations while making a choice between using interface and abstract class?
Which containers use a border layout as their default layout?