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

Are private methods final?

488


Why we use multi threading instead of multiprocessing?

576


Write a program in java to calculate the difference between the sum of the odd level and even level nodes of a binary tree.

532


What is final method?

583


What advantage do java's layout managers provide over traditional windowing systems?

548






What is tostring () method?

546


What is the use of beaninfo?

591


What is busy spin, and why should you use it?

590


How can an object be unreferenced?

543


What is fundamental datatype?

531


Is string a datatype?

552


How do you call a reference in java?

523


Is integer a class?

569


What do you mean by synchronized non access modifier?

569


Is string a wrapper class?

519