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

What is string substring?

785


What is reverse function?

779


What access modifiers can be used for class ?

761


Differentiate between run time error and syntax error.

798


what is interface in java? Explain

721


How do you replace all in word?

706


when a request is generated from apache tomcat 5.5 and goes to oracle 10g or mysql,,, how the oracle or mysql reads the request as apache is a web server and oracle 10g is application server? when the oracle 10g provides response, how the apche tomcat reads it???

1889


What is purpose of applet programming?

886


What is the maximum size of hashmap in java?

734


What is compiler and what its output.

877


What is JVM and is it platform independent?

764


Which is easier .net or java?

833


What is default locale java?

779


Can we define private and protected modifiers for variables in interfaces?

803


What is proper subset?

758