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

Can we return null in java?

638


Tell me a few examples of final classes defined in Java API?

557


What is a function easy definition?

527


What is an iterator interface in java programming?

532


What is consumer in java?

520






What invokes a thread's run() method in java programming?

565


How is garbage collection controlled?

730


Why to use nested classes in java? (Or) what is the purpose of nested class in java?

521


How can you generate random numbers in java?

579


What does || || mean in math?

513


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

498


Can we sort array in java?

525


Is it possible to cast an int value into a byte variable? What would happen if the value of int is larger than byte?

542


What methodology can be utilized to link to a database?

504


Is java written in c?

538