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
Which sorting algorithm is best in java?
What purpose do the keywords final, finally, and finalize fulfill?
How variables are stored in memory?
What is :: operator in java 8?
What is boolean used for?
What is a top level class in java?
What does int argc char * argv [] mean?
How do you allocate memory to object?
Is list thread safe in java?
What is regex java?
What is replacefirst in java?
What sorting algorithm does javascript use?
What is unicode datatype?
What is the main function in java?
Can we override constructor in java?