In Java why we write public static void main(String args[])
why not main()?

Answer Posted / sivadasan

1. public - Access Specifier, properties and methods can
access anywhere, any package.

2. main() - The Java environment starts the execution of a
program from main() method.

3. void - The main() method is not return anything. So the
return type of the main() method must be void.

4. static - The jave environment able to call the main()
method without creating an instance of the class. So its
declared as static

5...(String args[]) -- In java, whatever we give, it will
takes as String. So we are giving the command line argumet
as String.


i hope it will help u..

Shivadasan
Coromandel Infotech

Is This Answer Correct ?    16 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is getclass () getname () in java?

675


What are identifiers in java?

571


State the main difference between c++ and java?

588


What is the statements?

586


What if constructor is protected in java?

556






Is there any limitation of using inheritance?

569


What is json parser in java?

611


What is string intern in java?

545


What’s meant by anonymous class?

594


What is a class in java?

578


How to make a class or a bean serializable?

537


What are jee technologies?

529


What is meant by local variable and instance variable?

592


How strings are created in java?

561


What is collection api?

604