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 a marker interface?

1086


What are the important features of Java 9 release?

949


Can we assign the reference to this variable?

921


Will the jvm load the package twice at runtime?

1043


What do you mean by compiler?

988


Is java free for businesses?

1006


What is a void in java?

1064


What is the replace tool?

1066


What is JDBC Driver interface?How can you retrieve data from the ResultSet

2045


What are the different types of constructor?

929


What are the 6 mandatory procedures for iso 9001?

946


What is function overriding and overloading in java?

1051


Can You Have Virtual Functions In Java?

1082


What is the longest unicode character?

1095


How to check if a list is sorted in java?

972