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 keyword and identifier?

0 Answers  


Name the method that is used to set a TextComponent to the read-only state?

1 Answers  


Can we override constructors?

0 Answers  


Explain Event handling in AWT?

1 Answers   Infosys, TCS,


What is the difference between an array and an array list?

0 Answers  






How is java hashmap implemented?

0 Answers  


Differentiate between nested and inner class in java.

0 Answers   Akamai Technologies,


How long will it take to learn java?

0 Answers  


What are register variables what are the advantages?

0 Answers  


What is an anonymous class?

1 Answers   IBM,


How do you compare two objects?

0 Answers  


What is mean by UML? what is the use? where we are using?

1 Answers   Eka Software,


Categories