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 do you mean by order of precedence and associativity?
how would you implement a thread pool? : Java thread
Is int a class in java?
What is functional interface in javatpoint?
Can we nested try statements in java?
what is meant by Byte code concept in Java?
How do you start a new line in java?
Can we change the scope of the overridden method in the subclass?
How do you escape a string?
What is a flag variable?
What is exception hierarchy in java?
How many static init can you have?
What is the use of jtable?
What are multiple inheritances?
What is difference between array and vector?