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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

How is garbage collection controlled?

725


How to instantiate member inner class?

619


Is object a data type in java?

580


What is the synonym of procedure?

526


Which is better stringbuilder or stringbuffer?

524






How objects of a class are created if no constructor is defined in the class?

574


How to call one constructor from the other constructor ?

595


Write a code to create a trigger to call a stored procedure

530


What is e java?

552


Which of the following is not an isolation level in the JDBC

1605


Draw a UML class diagram for the code fragment given below: public class StringApplet extends Applet { private Label sampleString; private Button showTheString; private ButtonHandler bHandler; private FlowLayout layout; public StringApplet() { sampleString = new Label(" "); showTheString = new Button (" Show the String"); bHandler = new ButtonHandler(); layout = new FlowLayout(); showTheString.addActionListener(bHandler); setLayout(layout); add(sampleString); add(showTheString); } class ButtonHandler implements ActionListener { public void actionPerformed(ActionEvent e) { samplestring.setText("Good Morning"); } } } Note: The methods need not be indicated on the diagram.

1578


Which data type is a class in java?

567


Can a class have an interface?

546


What are the java ide's? Explain

521


What is difference between arraylist and list in java?

576