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 message driven beam?

1002


What is the purpose of the notifyall() method?

989


What are the pros and cons of detached objects?

932


What must a class do to implement an interface?

1097


which book is better for jdbc ,servlets and jsp

2050


What is the difference between the session.get() method and the session.load() method?

1039


difference between  ejb,struts,hibernate,spring and jsp

2811


Can I run seam with jdk 1.4 and earlier?

940


What are the types of scaling?

1048


What are the design considerations while making a choice between using interface and abstract class?

1019


What is the immediate superclass of the applet class?

1029


What is the difference between the ‘font’ and ‘fontmetrics’ class?

1109


What is an abstract method?

1004


Why doesn’t the focus feature on the tag work in every circumstance?

1035


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

995