In Java why we write public static void main(String args[])
why not main()?
Answer Posted / ashish jindal
public static void main(String ashish[])
1. PUBLIC:- it is a access modifier through which a class or
a data member can be accessed anywhere. Main Class is Public
because it is called explicitly by Java Virtual Machine.
2. Static:- Static is used to call the main without creating
object. If Static is not used then it will behave like a
instance member function and instance member functions can
change the properties of its own object's members and functions.
3. Void:- Main do not returns any value.
4. String:- In java everything is accepted as a string.
| Is This Answer Correct ? | 7 Yes | 0 No |
Post New Answer View All Answers
What is the difference between procedural and object-oriented programs?
What is the public field modifier?
What are the high-level thread states in java programming?
What is a java lambda expression?
Is java platform independent?
What happens if an exception is throws from an object's destructor?
When a thread is executing a synchronized method , then is it possible for the same thread to access other synchronized methods of an object ?
What are the different ways of creating thread?
Is class forname reflection?
What are the advantages of arraylist over arrays?
why java uses class level type casting ?
What is void keyword?
What is floor in java?
What is lossy conversion in java?
What is a stack class in java ?