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

What is the immediate superclass of the applet class?

1139


What is the argument type of a programs main() method?

1173


Is jvm a overhead?

1165


How messaging services are done, before release of JMS?

2227


Why a component architecture for the java platform?

1317


Can I map more than one table in a cmp?

1132


What is the difference between the string and stringbuffer classes?

1163


What is the difference between a menuitem and a checkboxmenuitem?

1178


What is the difference between long.class and long.type?

1180


What are the services in RMI ?

2448


What classes of exceptions may be caught by a catch clause?

1081


What are callback interfaces?

1139


How to deploy Jar, War files in J2EE?

2738


What do you mean by Socket Programming?

1140


How are the elements of a borderlayout organized?

1176