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
How is it possible in java programming for two string objects with identical values not to be equal under the == operator?
What is the use of volatile in java?
What is final access modifier in java?
What do you mean by constructor?
What is the use of optional ?
What is the ==?
What does n mean?
Is finalize() similar to a destructor?
Can a static block throw exception?
What is public static?
Difference between keyword and identifier.
What is class and object in java?
What is the difference between size and length in java?
What is the same as procedures?
Can we override a variable in java?