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 synchronized and synchronized block?
What is the largest long allowed by java?
What is the difference between hashmap and hashtable in java?
Can you explain inner class.
Explain about narrowing conversion in java?
When do you get classcastexception?
What is boolean false?
What is the difference between form & report?
Does java return by reference?
What are operators and its types?
Which is faster call by value or call by reference?
What is the difference between the file and randomaccessfile classes?
What is a stringbuffer?
Explain creating threads by extending thread class ?
Why we use multi threading instead of multiprocessing?