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 a text string?
What is used of static keyword in java?
Differentiate between static and non-static methods in java.
How do you compare objects in java?
How to display names of all components in a Container?
When is the arraystoreexception thrown?
Can I declare a class as private?
Outline the major features of java.
How do you reverse a string in java?
Why does java doesnt suuport unsigned values?
What are the three best choices for a development environment?
What is the difference between a switch statement and an if statement?
Write a program to reverse array in place?
What is maximum size of arraylist in java?
What is better- service oriented or batch oriented solutions?