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 immutability in java?
What is class level lock ?
What is the concept of multithreading?
What is the basic concept of java?
What is enhanced loop in java?
What is the difference between multiple processes and multiple threads?
How many bytes are there?
What does exp mean in math?
Can a method be overloaded based on different return type but same argument type?
What are the different approaches to implement a function to generate a random number?
What is size of int in java?
difference between byte stream class and character stream class?
Is upper case in java?
What is cr keyboard?
What is the disadvantage of synchronization?