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

What is a boolean structure?

771


Why java is not 100% object-oriented?

1168


Can a abstract class be declared final?

764


Is minecraft 1.15 out?

734


What are the advantages of java over C++?

922


Which variable is the independent variable?

763


Can we have multiple classes in single file ?

806


Is vector thread safe in java?

754


What is singletonlist in java?

699


Can a class be private in java?

733


Differentiate between postfix and prefix operators in java.

861


How do you reverse a string in java without using string buffer?

796


Explain polymorphism citing an example.

790


Does java isempty check for null?

759


What is the common usage of serialization?

786