In Java why we write public static void main(String args[])
why not main()?
Answer Posted / xyz
Public -> Because we want to access the main from the out side of the class generally when we run the java program at that time it call the main method.
Static ->Because it will create only one copy of main method and we can call with class name so when we run program it will
run main method using passed program name like name.main();
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is charat java?
Why stringbuffer is faster than string?
How do you convert bytes to character in java?
What are the disadvantages of using inner classes?
Does list allow duplicates in java?
How do you declare an array in java?
What is field name?
What is a default method?
How java uses the string and stringbuffer classes?
How does predicate work in java?
Why string is called as immutable?
What is better - 'bit-shift a value' or 'multiply by 2'?
Can we inherit inner class?
What is bubble sort in java?
What are anonymous inner classes?