In Java why we write public static void main(String args[])
why not main()?
Answer Posted / xyz
Public -> Because we want to access the main from the out side of the class generally when we run the java program at that time it call the main method.
Static ->Because it will create only one copy of main method and we can call with class name so when we run program it will
run main method using passed program name like name.main();
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is lifetime variable?
What is a map in java?
I want to control database connections in my program and want that only one thread should be able to make database connection at a time. How can I implement this logic?
What is the use of join method?
What is a memory leak in java?
What is meant by tab pans?
Can we create our own daemon thread?
What is method and methodology?
Describe 2 different ways to concatenate two strings.
How to provide security in java
When throws keyword is used?
Can you make a constructor final?
How do I get the | symbol on my keyboard?
Is string thread safe in java?
How many types of flags are there?