In Java why we write public static void main(String args[])
why not main()?
Answer Posted / prabhakant prabhakar rasal
We write public because to access main() method outside the
class.
Why static because to invoke main() method before creating
any object, so it simple to compiler that to identify the
main() method.
void, it represents that it does not returns any value.
string args[]
There are two main reasons to write string args[]
1. TO identify the program
2. To get command_line arguments
| Is This Answer Correct ? | 27 Yes | 13 No |
Post New Answer View All Answers
Why do we need hashset in java?
Which class is the superclass for all the classes?
Write a program to reverse a number in java?
Write a program in java to establish a connection between client and server?
What is the order of arraylist in java?
What are extraneous variables examples?
What is an object’s lock and which object’s have locks?
Why a dead thread occurs?
How many ways can you break a singleton class in java?
Can a main method be overloaded?
Is Java a dying language?
What are the two types of java?
What are constants?
What is console based application in java?
How do you check if two given string are anagrams?