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 starvation?

690


Explain an algorithm to find depth of a binary tree.

558


What is the difference between the boolean & operator and the && operator in java programming?

572


What does function identity () do?

522


Is java a software?

520






Is java written in c?

552


Is void a wrapper class?

537


Which are different kinds of source code?

666


what is nested class in java?

605


how to create daemon thread in java?

615


How do you convert bytes to character in java?

539


What is the basic of java?

575


How are variables stored in memory?

587


What are the major advantages of internal iteration over external iteration?

582


How many bits is a char?

539