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
Write a program to find maximum and minimum number in array?
Can a class be defined inside an interface?
Is final static java?
Explain where variables are created in memory?
What is variable and its types?
Can we create an object if a class doesn't have any constructor ( not even the default provided by constructor ) ?
Can we use this () and super () in a method?
How an object is serialized in java?
what is thread in Java ?
What is an argument java?
Can we declare a class as abstract without having any abstract method?
If an application has multiple classes in it, is it okay to have a main method in more than one class?
Difference between predicate, supplier and consumer ?
How do you declare a string variable?
What is jvm? How its run?