what is the difference between static block and static
method

Answer Posted / sukhvider

static block executes whenever the class loaded in the Java virtual machine that means object is before going to main Method.

Is This Answer Correct ?    1 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is object in java?

777


Why should I use abstract class?

796


What is abstraction in java?

849


What is the meaning of flag day?

762


Difference between string, string builder, and string buffer?

768


What is the maximum size of hashmap in java?

758


What do you mean by global variable?

728


How do you sort words in java?

738


What is a for loop in java?

838


What is a bubble sort in java?

744


Can memory leak in java?

810


How do you check if a number is a perfect square?

765


Can I import same package/class twice?

708


Write a java program that prints all the values given at command-line.

775


Why declare Main() method as a static in java ?

836