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 a static block?

Answer Posted / ranganathkini

A static block or a static initializer is a block that
appears within a class definition but outside any member
definition with the keyword static ahead of it. Example:


class MyClass {
private static double myValue;
static {
myValue = Double.parseDouble( System.getProperty(
"version" ) );
}
}

It is mainly used to perform static construction i.e.
initialization of static variables (see above example). The
static initializer is executed when the class is loaded by
the JVM.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is singleton class example?

1087


What is java command?

1130


Explain the importance of throws keyword in java?

1046


What is java used for on a computer?

1038


What is the purpose of the System class?

1042


What is difference between equal and == in java?

1008


What are the main uses of the super keyword?

1024


what is the purpose of the wait(), notify(), and notifyall() methods? : Java thread

1048


What exceptions occur during serialization?

1149


What data type is string java?

1006


Explain the difference between comparator and comparable in java?

1029


How do you detect memory leaks?

1116


What is final keyword in java? Give an example.

1063


What is bean? Where it can be used?

1143


What are 3 boolean operators?

1054