what is the difference between statis block and static
variable

Answer Posted / ravikiran

static block is used to initialize the variables during the
Jvm start up.
static variable is used to declare the class level
variables whose value remains ame for the whole class.

Is This Answer Correct ?    1 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is ++ operator thread-safe in java?

636


How do you check if a string is lexicographically in java?

503


Can you override a final method?

582


What is class forname used for?

542


Which command from the jdk compiles a java program?

489






If an object reference is set to null, will the garbage collector immediately free the memory held by that object?

637


What is data type in java?

487


Can we use a default constructor of a class even if an explicit constructor is defined?

655


Why do we need variables?

531


Are arrays immutable in java?

543


Is an object null?

561


What is starvation?

684


what is thread in Java ?

628


What is java and why do we need it? Explain

585


If goto and const is reserve words than why it is not work in java?

1508