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 / nisha

/* STATIC METHODS CANT BE OVERRRIDDEN....*/

class Animal {
static void doStuff() {
System.out.print("a ");
}
}

class Dog extends Animal {
static void dostuff() { // it's a redefinition,
// not an override
System.out.print("d ");
}

public static void main(String [] args) {
// Animal [] a = {new Animal(), new Dog(), new Animal()};
// for(int x = 0; x < a.length; x++)
// a[x].doStuff(); // invoke the static method

dostuff();
Animal a=new Dog();
a.doStuff();
}
}

Is This Answer Correct ?    2 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

If we opened Windows Internet Explorer 4 times, does it starts 4 processes or 4 threads?

2254


Whats new with the stop(), suspend() and resume() methods in jdk 1.2?

1111


What is a class loader? What are the different class loaders used by jvm?

1161


which type of objects reference will be given to client?

2525


whats is mean by connectionpooling

2062


Which javutil classes and interfaces support event handling?

1103


Explain about local interfaces.

1121


What is bean? Where can it be used?

1250


How substring() method of string class create memory leaks?

1101


What are the difference between RMI and CORBA?

1171


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

1145


What is a tasks priority and how is it used in scheduling?

1114


Difference between hashmap and hashtable?

1235


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

1177


What is the form of storage space in java?

2302