when everything can be done by static block then why do we
use main method?.
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / guest
the main block is declared as static sothat the java
interpreter could use it without instantiating it,but if we
declare everything as static there is no meaning of a class
and specifying instance variables and methods belong to
that specific class only.
| Is This Answer Correct ? | 2 Yes | 1 No |
What are loops in java? What are three types of loops?
What is a protected method?
Why java is a platform independent? Explain
What is passing parameters in java?
What is deserialization and how do we do deserialization?
Can you change array size in java?
Can we have a abstract class withought any method? What is a purspose of this?
Is java developer a good career?
To what value is a variable of the Boolean type automatically initialized?
What is the difference between a switch statement and an if statement?
How can I debug the Java security exceptions and AccessControlExceptions?
'A class is a template for an object' explain this statement.
0 Answers Akamai Technologies,