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
Can we extend a class with private constructor?
What is the benefit of inner classes in java?
What is the use of flag?
Which is better stringbuffer or stringbuilder?
What is string pool in java?
How many bits are used to represent unicode, ascii, utf-16, and utf-8 characters?
Why java is platform independent? Explain.
From the two, which would be easier to write: synchronization code for ten threads or two threads?
What are triggers in DB? Explain their types. How do they work?
What do you mean by light weight and heavy weight components?
Can we define package statement after import statement in java?
What is use of static method?
What is the final variable?
Can a class be declared as static?
What is the purpose of a volatile variable?