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 extend a class with private constructor?

734


What is the benefit of inner classes in java?

861


What is the use of flag?

860


Which is better stringbuffer or stringbuilder?

725


What is string pool in java?

776


How many bits are used to represent unicode, ascii, utf-16, and utf-8 characters?

838


Why java is platform independent? Explain.

800


From the two, which would be easier to write: synchronization code for ten threads or two threads?

833


What are triggers in DB? Explain their types. How do they work?

875


What do you mean by light weight and heavy weight components?

764


Can we define package statement after import statement in java?

789


What is use of static method?

770


What is the final variable?

946


Can a class be declared as static?

900


What is the purpose of a volatile variable?

770