what is the difference between static block and static
method
Answer Posted / navaneesh
i think static block is executed, when the class is
loaded.That means at the time of compile time.so that
block sill executed first.
where as static method have to call seperately and also it
can call with out object instance.so it executed when run time.
| Is This Answer Correct ? | 56 Yes | 20 No |
Post New Answer View All Answers
Can a private method be declared as static?
Where and how can you use a private constructor?
Where is java located?
What is the exact difference in between unicast and multicast object? Where we will use?
What are static variables and functions?
What is a boolean used for?
How is string stored in java?
What exceptions occur during serialization?
What is supplier in java?
What is the difference between static method and instance method in Java?
Can you pass by reference in java?
Explain the difference between private, public, package and protected in java?
What are use cases?
What is static keyword?
What happens when you invoke a thread’s interrupt method while it is sleeping or waiting?