what is the difference between statis block and static
variable

Answer Posted / ramakrishna

Static block is the block which is executed first in the
program. Static variable is the common variable which is
shared by all the objects. Static variable is not specific
to any object.

Is This Answer Correct ?    11 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

I want to persist data of objects for later use. What is the best approach to do so?

820


how we can create packages in java?

730


What is visibility mode?

741


What is the difference between == and === javascript?

821


What will be the default values of all the elements of an array defined as an instance variable?

784


What is thread synchronization in java?

672


What is package private scope in java?

725


What is nested top-level class?

786


What is the reflection?

788


Why do we need data serialization?

750


What are the java ide’s?

807


Can you call a method on a null object?

773


Can you extend main method in java?

854


What is difference between path and classpath variables?

825


Explain different ways of creating a thread. Which one would you prefer and why?

813