In Java why we write public static void main(String args[])
why not main()?
Answer Posted / amardip sabale
we write public static void main() because
public:for access of main function all over the program
static:main is also one type of method,and for calling this
method while running our program without creation of any
object
void:because it is not return anything
String args[]:because when we run our program then always
we pass at least two command line arguments(java and
program name)for collecting them we have to write it
*THANKS*
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How to use arraylist in java netbeans?
List some oops concepts in java?
What happens if main method is not static?
Is empty in java?
How do you write a good declaration?
What is method reference in java?
What is the access scope of protected access specifier?
What mechanism does java use for memory management?
Will the compiler creates a default constructor if I have a parameterized constructor in the class?
What is the purpose of static methods and variables?
Can we able to pass objects as an arguments in java?
How can you avoid serialization in child class if the base class is implementing the serializable interface?
what is nested class in java?
What is local variable and instance variable?
Is there a way to increase the size of an array after its declaration?