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 use of isempty in java?
Which java version is latest?
What is an example of a conditional statement?
Implementations of set interface?
What does the exclamation mark mean in java?
Whats the difference between notify() and notifyall()?
What are keywords give examples?
When is the garbage collection used in Java?
Is a boolean variable?
What are the different http methods?
What is variable and its types?
What is var keyword ?
What are checked exceptions?
Explain public static void main(string args[]) in java.
Can you call one constructor from another if a class has multiple constructors?