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

what is java bean?where can we use it?

12 Answers   TCS,


Can a class be private or protected in java?

0 Answers  


What is method Overloading in the perspective of OOPS?

6 Answers  


Can we make constructors static?

0 Answers  


what is nested class in java?

0 Answers   IBS,






How do you write a scanner class in java?

0 Answers  


What causes memory leaks in java?

0 Answers  


I need some details about an employee. i have only the employee id in my presentation layer(JSP).I entered that ID and click "Show Details" Button. Question is how the JSP pass that id to Controller layer and DAO and what mechanism we are using to retrive data from DB and how the data passed to JSP as a Output. Please explain in detail.

1 Answers   TCS,


what is marker interface ? what is the necessity of it?

5 Answers   Accenture, Newgen,


What is the ==?

0 Answers  


What is the Concept of Encapsulation in OOPS

0 Answers   HCL,


why not override thread to make a runnable? : Java thread

0 Answers  


Categories