Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

To what value is a variable of the string type automatically initialized?

1167


What is RMI and what are the services in RMI?

1247


What are various types of class loaders used by jvm?

1041


What is clustering? What are the different algorithms used for clustering?

1124


what are the advantages of JTA over JTS?

2286


What is the difference between a static and a non-static inner class?

1205


When is the best time to validate input?

1148


what is a non-repeatable read?

2521


How to implement RMI in Java?

2926


What are transaction attributes?

1157


which type of objects reference will be given to client?

2520


If your ui seems to freeze periodically, what might be a likely reason?

1114


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.

2281


Which component handles cluster communication in jboss?

1160


Why do I get a duplicate name error when loading a jar file?

1194