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

How can we find the sum of two linked lists using stack in java?

1154


What is bitwise complement?

987


What is passing parameters in java?

1043


how is final different from finally and finalize in java?

1058


What are singleton services?

913


How can you handle java exceptions?

1032


Can a class be declared as static?

1171


What are the types of inner classes (non-static nested class) used in java?

1065


What is meant by method overriding?

1113


What are the steps in the jdbc connection?

1025


What is singleton class in ruby?

1016


How can an object be unreferenced?

1024


How much ram can a 64 bit processor theoretically?

901


What is the benefit of inner / nested classes ?

988


Can a static block throw exception?

1096