What is the use of static block?

Questions by kalaijavatest

Showing Answers 1 - 7 of 7 Answers

sbarik

  • May 12th, 2007
 

Use static block when theres a requirement to execeute block of code when the class is loaded . That mean to do some class level tasks we use staic block

  Was this answer useful?  Yes

The primary use of static initializers blocks are to do various bits of initialization that may not be appropriate inside a constructor such that taken together the constructor and initializers put the newly created object into a state that is completely consistent for use.

  Was this answer useful?  Yes

sampra

  • Feb 14th, 2008
 

static block is the set of stmnt between {} and declared as static its exceute at class loading time

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions