what is the difference between static block and static
method
Answer Posted / raghavendra
As soon as the class is loaded, the static block will be
executed. Where as the static method should be called
explictly.
| Is This Answer Correct ? | 51 Yes | 4 No |
Post New Answer View All Answers
What is the maximum length of a url?
When to use runnable interface vs thread class in java?
Can we have multiple classes in a single file?
What are the rules for variable declaration?
How can an exception be thrown manually by a programmer?
What is equals method in java?
Is string pool garbage collected?
How many ways can an argument be passed to a subroutine and explain them?
What is the exception hierarchy in java?
What is the difference between form & report?
What is java objectoutputstream?
Why does java have two ways to create child threads?
How can we create an immutable class in java?
Where local and global variables are stored?
What happens if a try-catch-finally statement does not have a catch clause to handle an exception that is thrown within the body of the try statement?