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 the difference between delete and delete[]
Explain different types of wrapper classes in java?
What are the main uses of the super keyword?
What is meant by polymorphism?
Explain exception chaining in java?
How do you replace a string in java?
What are Normalization Rules? Define Normalization?
What are desktop procedures?
What is a two-pass assembler?
What is thread life cycle in java?
When do we use synchronized blocks and advantages of using synchronized blocks?
What are the methods of object class ?
Can we execute java program without main method?
What is parsing in java?
What isan abstract class and when do you use it?