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 we override static methods?

Answer Posted / manikandan [ gtec,vellore ]

Dear yogesh, overriding is not a compile time polymorphism
so u have to run the code.

static methods can't override
pls run below example

class test extends a
{
public static void main(String[]asd)
{
a as=new test();
as.a();//it'll not invoke a() from class test
}
static void a()
{
System.out.println("test");
}
}
class a
{
static void a()
{
System.out.println("a");
}
}

out put: a

as.a(); this line'll not invoke the method a()from class
test instead it'll invoke a a()method from class a so there
is no overriding.

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the exact difference in between Unicast and Multicast object? Where will it be used?

1000


Can we create object of static class?

975


Considering notepad/ie or any other thing as process, what will happen if you start notepad or ie 3 times? Where 3 processes are started or 3 threads are started?

1101


What is numeric function?

951


What is difference between classpath and path variables in java?

1134


How are this() and super() used with constructors in java programming?

1017


How we can execute any code even before main method?

1076


what is ststic with example

2002


Why java applets are more useful for intranets as compared to internet?

1014


How do you use nextline in java?

904


What’s the difference between unit, integration and functional testing?

1049


What is xslt in java?

936


What does jenkins do?

866


Is space a character in java?

963


What does string mean in java?

1041