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


Please Help Members By Posting Answers For Below Questions

Can we pass a primitive type by reference in java? How

534


Is null keyword in java?

534


What is the syntax and characteristics of a lambda expression? Explain

547


What is the difference between superclass and subclass?

551


What is a predicate method?

568






Why main function is static?

676


How is it possible in java programming for two string objects with identical values not to be equal under the == operator?

569


If I don't provide any arguments on the command line, then what will the value stored in the string array passed into the main() method, empty or null?

715


How do you sort objects in java?

522


Why is multiple inheritance not supported in java?

564


What are the important features of Java 8 release?

582


What are the advantages of encapsulation in java?

556


What does method mean?

521


Why do we need array in java?

537


what is meant by HQL?

646