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

List out benefits of object oriented programming language?

895


Explain thread in java?

1163


What is mnemonic in assembly language?

1073


Are primitives objects?

1052


What is an image buffer?

993


What is byte code and why is it important to java’s use for internet programming?

1129


What are the differences between graph and tree?

1122


What is oop principle in java?

1157


What is computer compiler?

998


What is final, finally, finalize?

1103


If two threads have same priority which thread will be executed first ?

1477


What are the four pillars of java?

1208


How the interruptible method gets implemented?

973


Is class is a data type?

1072


Explain the difference between private, public, package and protected in java?

1041