what is the difference between static block and static
method

Answer Posted / himanshu kumar upadhyay

Static block is executed when the class which contain static
block is loaded in to memory and static method is executed
when it is called. Mostly static block is used for
Initialization of static members.

Is This Answer Correct ?    17 Yes 2 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 c better than java?

547


Is map sorted in java?

572


Can we use synchronized block for primitives?

607


What are the 2 types of java programs?

567






What is contractor means and methods?

561


How can you add and remove nodes in jtree?

617


How many types of gc are there in java?

572


What is difference between adapter class and listener?

503


What is the flag in java?

612


Is char a data type in java?

548


Differentiate between class and structure.

635


What does the append?

500


How does a for loop work?

509


What is difference between filereader and bufferedreader?

537