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
Explain working of call by reference function invoking.
What are recursive functions? Give some examples?
What is a newline character in java?
what is the role of xml in core java?? and how we can use it?? can somebody give a sample program with explanation and from where i can read more about xml?????
Is it possible to define a method in java class but provide it’s implementation in the code of another language like c?
Why is boolean important?
What language is pass by reference?
What is meant by design patterns?
What are keywords in java?
Why is java architectural neutral?
Can a constructor call the constructor of parent class?
Why do we use regex?
Can you use abstract and final both with a method?
String and stringbuffer both represent string objects. Can we compare string and stringbuffer in java?
What languages are pass by reference?