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
What is difference between calling start() and run() method of thread?
Why collection doesn’t extend cloneable and serializable interfaces?
What happens when a thread cannot acquire a lock on an object in java programming?
Tell me a few examples of final classes defined in Java API?
Can you achieve runtime polymorphism by data members?
Can a class with private constructor be extended?
What does the exclamation mark mean in java?
What are extraneous variables examples?
What is meant by vector class, dictionary class, hash table class, and property class?
How to read and write image from a file ?
What is the byte order of byte buffer?
Why are data types important?
When should the method invokelater() be used?
What is a locale?
Explain how hashmap works?