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

how do you Handle Front End Application data against DB with example?

1915


Can I run seam with jdk 1.4 and earlier?

937


Define prototype?

998


we use MainFrame and using os390 for operating system with DB2 data base in IRAN and interest programing with java and use webspere for world wide,please help me where i should start?

2364


What are callback interfaces?

1049


What is the difference between system.out ,system.err and system.in?

1047


What is in-memory replication?

1009


What is the form of storage space in java?

2197


Why doesn’t the focus feature on the tag work in every circumstance?

1030


Java is fully object oriented languages or not?

942


Can I use javascript to submit a form?

1095


Define the remote object implementation?

2401


What modifiers may be used with an inner class that is a member of an outer class?

1002


What is the diffrence between a local-tx-datasource and a xa-datasource? Can you use transactions in both?

979


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

1087