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 threadfactory?

1104


Can I run seam outside of jboss as?

1080


what is a non-repeatable read?

2433


Explain the difference between object state and behavior?

1057


What is the highest-level event class of the event-delegation model?

1104


Why won’t the jvm terminate when I close all the application windows?

1248


What is a session? Can you share a session object between different theads?

984


Will the general public have access to the infobus apis?

1057


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

2170


What are transaction attributes?

1116


What is the purpose of the notifyall() method?

1043


What is clustering? What are the different algorithms used for clustering?

1083


Which characters may be used as the second character of an identifier, but not as the first character of an identifier?

1055


Where can I find seam examples and documentation?

1099


How are the elements of a borderlayout organized?

1118