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
Is singleton thread safe in java?
What is the vector class in java programming?
Is java based on c?
What do you understand by the bean persistent property?
What is difference between throw and throws ?
How to run a JAR file through command prompt?
What is the default value of the local variables?
Where is java located?
What is JFC?
Why hashmap is used in java?
What are autoboxing and unboxing? When does it occur?
What are filterstreams?
Mention a package that is used for linked list class in java.
Define a package.
What are implicit objects in java?