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 between static block and static
method

Answer Posted / kishore reddy

static{} blocks are executed on its own as soon as the
program starts. i.e before the main method is called where
as static() is called ONLY from another static method ie
main method.

static() has several restrictions:
1. Can ONLY call other static ()
2. MUST ONLY access static data
3. cant refer to super or this

Is This Answer Correct ?    14 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we have a try block without catch block?

951


What is the use of beaninfo?

994


What happens if we override private method?

923


Explain working of call by reference function invoking.

975


What is command line used for?

1060


How are multiple inheritances done in Java?

1100


How can we make a class virtual?

1072


Why null value is used in string?

996


what is optional in java 8?

1019


What is the use of parse function in java?

938


What is an argument in java?

903


Can you instantiate the math class in Java?

1036


What is == in java?

969


What is the use of singleton?

917


Can you override a final method?

993