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

If a subclass defines a static method with the same signature as a static method in the superclass, the method in the subclass hides the one in the superclass. The distinction between hiding and overriding has important implications.

public class Animal
{
public static void hide()
{
System.out.format("The hide method in Animal.");
}
public void override()
{
System.out.format("The override method in Animal.");
}
}

public class Cat extends Animal
{
public static void hide()
{
System.out.format("The hide method in Cat.");
}
public void override()
{
System.out.format("The override method in Cat.");
}
}

But still I am not convinced with the exact difference in between hiding and overriding a method...???

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Do we need to override service() method

1659


What is the map interface?

1080


What is the difference between the font and fontmetrics classes?

1083


What method is invoked to cause an object to begin executing as a separate thread?

977


What is the difference between ear, jar and war file?

1066


Can I import same package/class twice? Will the jvm load the package twice at runtime?

1085


How messaging services are done, before release of JMS?

2075


Describe activation process?

2603


What is the difference between RMI registry and OS Agent?

1075


Why is string immutable in java?

1057


what is meant by JRMP?

2269


How to deploy Jar, War files in J2EE?

2623


Can I run seam with jdk 1.4 and earlier?

940


In inglish: How to convert jar to exe files? Em português: Como converter arquivos .jar para .exe?

2612


Why use POJO when I can use hashmap

2591