what is the difference between static block and static
method

Answer Posted / khasim

static block will be called at the time of loading the
class.it can be called once.developer can not be called
expecitly
static method will called at the time of loading the
class.here we can call expecitly by using there classname

Is This Answer Correct ?    16 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to perform quicksort in java?

573


How to run a JAR file through command prompt?

719


I want my class to be developed in such a way that no other class (even derived class) can create its objects. Define how can I do so?

700


Difference between a class and an object?

583


What is meant by stack and queue?

608






What is the advantage of OOP in java?

663


Which containers use a flowlayout as their default layout in java programming?

515


Why is java called java?

545


Is vector thread safe in java?

562


What two classes are used to read data only?

643


What is method reference?

520


What is a default method?

524


Can a class be private?

520


What is increment in java?

528


When do I need to use reflection feature in java?

627