In Java why we write public static void main(String args[])
why not main()?
Answer Posted / kedar
static methods can be accessed without creating object object of class, we know that file name of java program is "classname.java", "classname" is the class which contain main function, so it is easier for compiler to locate class which contain main(), and because of static nature it can execute it.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What environment variables do I need to set on my machine in order to be able to run java programs?
Is java a software?
Can we return null in java?
What is private static in java?
Explain reverse a linked list recursive java solution?
Explain purpose of sleep() method in java?
What is the simpletimezone class in java programming?
Is java a security risk?
What data type is true or false?
How does queue work in java?
What is java util?
How does java pattern compile work?
What is a double vs float?
What is Java Shutdown Hook?
Why java is not 100% object-oriented?