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


Please Help Members By Posting Answers For Below Questions

Are enterprise beans allowed to use thread.sleep()?

639


Define the remote object implementation?

1991


What is the relationship between an event-listener interface and an event-adapter class?

548


What is re-entrant. Is session beans reentrant. Is entity beans reentrant?

570


What is mdb and what is the special feature of that?

556






What is ripple effect?

627


What are the pros and cons of detached objects?

541


Are we allowed to change the transaction isolation property in middle of a transaction?

554


What is Remote Server?

1678


What is the purpose of the notify() method?

589


Explain how will the struts know which action class to call when you submit a form?

515


In RMI, inorder to sent the stub reference to the client, is we have to load the server object first into the memory or can we directly sent reference to the client?

1550


How to pass parameters in RMI?

1681


What is jboss?

564


What are the benefits of detached objects?

577