Similarity and difference between static block and static method ?



Similarity and difference between static block and static method ?..

Answer / Vipin Chaudhary

Both static blocks and static methods are related to classes, not objects. They can be accessed before any objects of the class are created. The main difference is that a static block initializes static variables, while a static method performs operations on those variables.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

How do you convert an int to a string in java?

1 Answers  


What is a JAR file?

1 Answers  


What is the largest number a double can hold?

1 Answers  


What is hard code & soft code?

7 Answers   Cognizant, Wipro,


Is 0 true or false in java?

1 Answers  


Can applet in different page/s communicate with each other?

1 Answers  


Why are the methods of the math class static?

1 Answers  


What is the major drawback of internal iteration over external iteration?

1 Answers  


What is literal example?

1 Answers  


How do you write methodology?

1 Answers  


what is difference between servletconfig and servletcontext?

3 Answers   Amdocs,


Explain the scope or life time of class variables or static variables?

1 Answers  


Categories