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
What is the use of singleton?
What are advantages and disadvantages of OOPs?
What is map in java?
What is a constructor overloading in java?
What the difference is between execute, execute Query, execute Update?
What is complexity and its types?
Can we convert integer to string in java?
What is a conditional statement explain with example?
How do you read a char in java?
What are the types of casting?
I want to persist data of objects for later use. What’s the best approach to do so?
Is a char always 1 byte?
Can size_t be negative?
What is unsigned char?
Is java 1.7 the same as java 7?