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...

what is the difference b/w static and final methods?

Answer Posted / guest

There is lot of difference b/w static and final Method....

Static Method.....

1). Static Method is part of class object. all static method
is loading after class is loading into the Memory(i.e heap).
2). All static Method can be access by Either class Name or
instance of the class.
3). While static method accessing by instance of the class
compiler is internally it converting into it's class reference.
4). Static methods can't be override.
5). By static Method we can't achieve Dynamic Method
dispating functionally.
6). static method is part of class object only.
7). Static method can't be call the non-static method
directly(i.e without creating instance of the class)
8). But Non static method can call the static methods.bcz of
static method are universal method these can be access by
any where either by class Name or by intance of the class.

Final Methods....

1). Final method are followed by final keyword.
2). Final method can't be inherited in subclass.
3). Final method can't be override in subclass also.
4). Final methods are faster than non-final methods because
they are not required to be resolved during run-time and
they are bonded on compile time.

For example

class PersonalLoan{
public final String getName(){
return "personal loan";
}
}
class CheapPersonalLoan extends PersonalLoan{
@Override
public final String getName(){
return "cheap personal loan"; //compilation error:
overridden method is final
}
}

Is This Answer Correct ?    9 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many bytes is a string in java?

972


What is a parameter example?

964


What is application tier?

1110


what is the use of pojo (plain old java objects)? how it is interact with crystal reports? pls urgent

2161


What is n in java?

931


How do you find the independent variable?

1038


Explain when we should make an instance variable private.

1100


Mention some interfaces implemented by linked list in java.

1013


Can I use % with real numbers?

1008


What are the differences between getting and load method?

1163


What are the six ways to use this keyword?

1051


What is the purpose of the finalize() method?

1235


What is anonymous inner class?

1071


Is map ordered in java?

927


How java uses the string and stringbuffer classes?

1046