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
Why javac is not recognized?
What are the different types of methodologies?
Explain about version control?
What is meant by string is immutable?
Is java ee a framework?
Which package has light weight components?
Can we declare the static variables and methods in an abstract class?
Is cout buffered?
List the three steps for creating an object for a class?
Does collectionutils isempty check for null?
Can we have return statement in finally clause? What will happen?
What is the difference between superclass and subclass?
What is volatile data type?
Is java a software?
What is the difference between ArrayList and Vector? which one is better in Java