In Java why we write public static void main(String args[])
why not main()?
Answer Posted / manik kumar bardhan
public means access specifier
static means
in general we always start execution from main()
but in java main() exist with in a class so when ever we r
executing any method which r within the class we need
instance variable to execute that method(a.print()) but here
without creating any instance main method will execute first
b/c static is the keyword which used for method then method
become a associated with class.for execution of that method
no need create instance.
void :return type
main is the method where java compiler starts execution.
| Is This Answer Correct ? | 3 Yes | 1 No |
Post New Answer View All Answers
What is a native method in java programming?
How to find the largest value from the given array.
Difference between arraylist and vector.
What is javac_g?
What is difference between char array and string?
What is a java predicate?
What is type safety in java?
What is a class instance variable?
Java is pass by value or pass by reference? Explain
Is sizeof a preprocessor?
What is main difference between variable and constant?
What is volatile data type?
How do I find and replace in word?
What is the difference between iterator and list iterator?
What are the two types of streams offered by java 8?