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 / dheerendra

static method can be overriden the case is that in in
subclass that method should also be static.

class A {
static void something () { System.out.println("static method
in A");}
}

class B extends A {
static void something () {System.out.println("static method
in B");}
}

class TestClass{

public static void main(String args[]){

A a = new A();
B b = new B();
A.something();
B.something();

A t = new B();
t.something();
}
}

the output is
static method in A
static method in B
static method in A

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

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

1160


In RMI, inorder to sent the stub reference to the client, is we have to load the server object first into the memory or can we directly sent reference to the client?

2103


Is the session factory thread safe?

1175


What is the difference between a static and a non-static inner class?

1158


what is meant by JRMP?

2357


Can constructors be synchronized in java?

1128


What is the difference between java class and bean?

1088


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

2170


how to use debug in my elipse to solve problems that exist in my project

2283


Is there a guarantee of uniqueness for entity beans?

1012


What is the diffrence between a local-tx-datasource and a xa-datasource? Can you use transactions in both?

1034


What is a clone?

1062


What are the types of scaling?

1091


How are the elements of a borderlayout organized?

1118


What is RMI and what are the services in RMI?

1176