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
Can we declare an interface as final?
How are variables stored in memory?
What are dot operator queries?
What is not thread safe?
What is int short for?
What is the hashcode () and equals () used for?
What is ellipsis in java?
What does n mean?
Explain the difference between jvm and jre?
Explain creating threads by extending thread class ?
What is boolean false?
What is sortedset in java?
What is meant by data hiding/encapsulation?
What is a dot notation?
what is meant by Garbage collection?