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 / ravi ranjan

Yes a static method can be overridden
see following two classes

public class Test extends Test2{

public static void main(String args[]){
String str="";
int b=Test.cal(4);
System.out.println(b);
Test t =new Test();
t.displayX();
}
public static int cal(int a){
int c=a*a;
System.out.println("Hi I am Child" );
return c;
}
}

class Test2 {
public static void main(String args[]){

}

public static int cal(int a){
int c=a*a;
System.out.println(c);
return c;
}

public void displayX(){
System.out.println("HI i am in Super");
}

}

Compile this code there is no compile or run time error

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is permgen or permanent generation?

1010


Name the class that is used to bind the server object with RMI Registry?

2150


the same information whether it will connect to the database or it will be used previous information?

1026


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

1123


Why a client should be multithreading? Explain.

1074


How is a java object message delivered to a non-java client?

1038


how do you Handle Front End Application data against DB with example?

1969


what are getters and setters in Java with examples?

1764


we use MainFrame and using os390 for operating system with DB2 data base in IRAN and interest programing with java and use webspere for world wide,please help me where i should start?

2409


what are the advantages of JTA over JTS?

2187


Java is fully object oriented languages or not?

984


What are the oops concept?

1050


What is the difference between static and non-static with examples?

1912


What is aop(assepct oriented programing)?

1037


What is the difference between session and entity beans?

1096