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

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

2209


Is a class a subclass of itself?

1222


What value does read() return when it has reached the end of a file?

1033


What is abstract schema?

1028


Describe, in general, how java's garbage collector works?

1039


Difference between new operator and class.forname().newinstance()?

1135


Why does the tag url-encode javascript and mailto links?

1009


What is synchronization and why is it important?

1117


Is it possible to stop the execution of a method before completion in a sessionbean?

1091


Is the infobus client side only?

1114


What is ripple effect?

1079


How can I scroll through list of pages like the search results in google?

969


Describe activation process?

2662


What happens when a thread cannot acquire a lock on an object?

1038


What are local interfaces? Describe.

1235