Why do we use public static with the main function in Java?
Answer Posted / shekhar chauhan
public static void main()- firstly, public which r used
globly access this method in our whole progam. and static
basically used for that we can used only one main method in
whole program.we can not create object that class. so we
make static main method.
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
What is meant by null and void?
What is immutable state?
What are the characteristics of java?
What is the difference between abstract class and interface1? What is an interface?
Explain implementation and how is it different from conversion?
What is variable declaration and definition?
What is the advantage of preparedstatement over statement?
What are the differences between the constructors and methods?
What are the 3 types of loops in java?
What is the use of default method in interface in java? Explain
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.
What is use of a abstract variable?
What is the difference between a switch statement and an if statement?
What is difference between static and abstract class?
What is the maximum size of array in java?