why we use main in java?

Answer Posted / amit

look guys,we use main() method inside java cause whenever we
compile .java file then jvm call classname.main() first
without make any object.main method must be public and static
cause public for wide accessing and jvm call main() without
creating any object its only possible when main() is static
method.and all the argument taken by main in form of string
thats why we write as.......
public static void main(String args[])
it canbe
public final static void main(String args[])

Is This Answer Correct ?    24 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Do we need to override service() method

1139


Will the general public have access to the infobus apis?

527


how do you Handle Front End Application data against DB with example?

1475


Why is actionform a base class rather than an interface?

568


Where can I ask questions and make suggestions about seam?

587






What modifiers may be used with an interface declaration?

556


Brief description about local interfaces?

627


Which characters may be used as the second character of an identifier, but not as the first character of an identifier?

541


What restrictions are placed on the values of each case of a switch statement?

535


What is a tasks priority and how is it used in scheduling?

543


To what value is a variable of the string type automatically initialized?

607


How task's priority is used in scheduling?

1779


What is re-entrant. Is session beans reentrant. Is entity beans reentrant?

577


Whats new with the stop(), suspend() and resume() methods in jdk 1.2?

581


What are the pros and cons of detached objects?

546