Why do we need public static void main(String args[])
method in Java...?



Why do we need public static void main(String args[]) method in Java...?..

Answer / shadow

We need
• public: The method can be accessed outside the
class / package
• static: You need not have an instance of the class
to access the method
• void: Your application need not return a value, as
the JVM launcher would return the value when it exits
• main(): This is the entry point for the application
If the main() was not static, you would require an instance
of the class in order to execute the method.
....!

$HADOW

Is This Answer Correct ?    14 Yes 0 No

Post New Answer

More Core Java Interview Questions

Why there is no call by reference in java?

0 Answers  


how can you take care of mutual exclusion using java threads? : Java thread

0 Answers  


How to retrieve data from database in java using arraylist?

0 Answers  


What is size of int in java?

0 Answers  


What is a class in java?

0 Answers  


What is treeset in java?

0 Answers  


whatis Home interface and Remoteinterface? with example?

0 Answers   Saksoft,


What is a nested list?

0 Answers  


What are autoboxing and unboxing? When does it occur?

0 Answers  


What is the method in java?

0 Answers  


What does three dots mean in java?

0 Answers  


What is structure of java heap? What is perm gen space in heap?

0 Answers  


Categories