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
Is there a way to increase the size of an array after its declaration?
Does java runtime require a license?
What is flush () in java?
What is the range of a character variable?
What causes memory leaks in java?
What is intern method in java?
Distinguish between a predicate and a function?
What is difference between an object and a class?
Which methods are used during serialization and deserialization process?
How do you sort a string in alphabetical order in java?
What does s mean in regex?
Can we use this () and super () in a method?
What java ide should I use?
Where local and global variables are stored?
Why string is not a wrapper class?