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

Define aop(assepct oriented programing)?

1150


Define the remote object implementation?

2490


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

1123


What is a modular application?

1058


Are there books about seam?

1079


Can you give me a simple example of using the requiredif validator rule?

1102


Java is fully object oriented languages or not?

984


What do you mean by Socket Programming?

1063


What is in-memory replication?

1043


For which statements does it make sense to use a label?

1062


What is the difference between a menuitem and a checkboxmenuitem?

1088


What is permgen or permanent generation?

1011


What are the benefits of detached objects?

1041


What is the difference between session and entity beans?

1097


What are the call back methods in entity bean?

1053