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

Why are some of the class and element names counter-intuitive?

563


What is the difference between a menuitem and a checkboxmenuitem?

575


Which component handles cluster communication in jboss?

618


What are the different class loaders used by jvm?

585


how i secure my site with the https protocol.what are the steps?

1730






cud u help me ... i am struggling with this question... to find all the subsets of a given set for ex.... a,,b,c shud give all the subsets.... i gt the program in c bt nt able to get it in java..... help needed ..

1726


Explain the different types of memory used by jvm?

602


What is the relationship between an event-listener interface and an event-adapter class?

549


difference between  ejb,struts,hibernate,spring and jsp

2291


how to make a index.jsp for running the site in internet and find an error for connection with weblogic server and java that give an error invalid object name.and how to maintain session.

1742


What is the difference between long.class and long.type?

553


what are getters and setters in Java with examples?

1278


What is the purpose of the notifyall() method?

599


What do you mean by Socket Programming?

540


What is the difference between RMI registry and OS Agent?

623