when everything can be done by static block then why do we
use main method?.

Answer Posted / hemanth kumar kalavagunta

Yes ... when everything can be done by static block then why
do we use main method. this is because, main method is the
only step from which compiler can enter the program to start
and this is the only way through which the data from outside
jvm can be entered into the jvm in the form of command line
arguments. using the static blocks there is no way to get
the data from the outside of the program and it is confined
to the program and program is it's world. main's world is
related both with the inside of jvm and outside of jvm.

Is This Answer Correct ?    12 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of singleton?

512


What are advantages and disadvantages of OOPs?

630


What is map in java?

518


What is a constructor overloading in java?

524


What the difference is between execute, execute Query, execute Update?

375






What is complexity and its types?

524


Can we convert integer to string in java?

598


What is a conditional statement explain with example?

540


How do you read a char in java?

463


What are the types of casting?

596


I want to persist data of objects for later use. What’s the best approach to do so?

500


Is a char always 1 byte?

507


Can size_t be negative?

613


What is unsigned char?

617


Is java 1.7 the same as java 7?

537