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 are variable names?
What is the size of boolean variable?
What is a newline character in java?
What are basic data types?
How does linkedhashmap work in java?
Can you tell me range of byte?
What is the size of arraylist in java?
What is a platform?
What are different data structures in java?
Are the imports checked for validity at compile time? Will the code containing an import such as java.lang.abcd compile?
Is arraylist ordered in java?
Can we able to pass objects as an arguments in java?
What is java util collection?
What does void * mean?
Does java support multiple inheritance or not?