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

Difference between hashmap and hashtable?

713


Explain the advantages and disadvantages of detached objects.

668


What is the difference between long.class and long.type?

662


Are there books about seam?

721


How is a java object message delivered to a non-java client?

655






Why a client should be multithreading? Explain.

702


What class is the top of the awt event hierarchy?

688


What event results from the clicking of a button?

789


What is the difference between the string and stringbuffer classes?

634


What is TL and its use?

2091


What is aop(assepct oriented programing)?

662


Can I use javascript to submit a form?

736


Why are my checkboxes not being set from on to off?

748


How many times may an objects finalize() method be invoked by the garbage collector?

758


Where we can write Rmi registry in the code, without having to write it at the command prompt?

2384