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
Can we rethrow the same exception from catch handler?
How we can execute any code even before main method?
What is an error in java?
What is tochararray in java?
How do you access command-line arguments within the code?
When can an object reference be cast to an interface reference in java programming?
why java uses class level type casting ?
Is a class subclass of itself?
How transient variable is different from volatile variable?
What is immutable state?
What is thread synchronization in java?
What is java virtual machine? Explain
What is an interface in java?
Which is easier .net or java?
why are there separate wait and sleep methods? : Java thread