why we use main in java?

Answers were Sorted based on User's Feedback



why we use main in java? ..

Answer / 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

why we use main in java? ..

Answer / poojadayal1989

we are using main in java bcoz its entry point of all
program..bcoz of static it can execute first.

Is This Answer Correct ?    6 Yes 2 No

why we use main in java? ..

Answer / suribabu

the program execution starts from the main()method.

Is This Answer Correct ?    2 Yes 0 No

why we use main in java? ..

Answer / sri

application begin execution by calling main() method of
that class

Is This Answer Correct ?    3 Yes 8 No

Post New Answer

More Advanced Java Interview Questions

Wt is the main difference between Java and Java J2EE and Advanced java?

5 Answers   Wipro,


To make an object to begin executing as a separate thread, what method is used?

2 Answers  


What is ioc concept?

0 Answers  


Explain Life cycle of Servlet Filter.

2 Answers   InfoBrain, ITC Infotech,


Where we can write Rmi registry in the code, without having to write it at the command prompt?

0 Answers  






what is stringBuffer and StringBuilder?

3 Answers  


what is Activation Instantinator?

0 Answers  


Write a program on RMI and JDBC using StoredProcedure?

1 Answers  


Define the remote interface?

1 Answers  


Are enterprise beans allowed to use thread.sleep()?

0 Answers  


What happens when a thread cannot acquire a lock on an object?

0 Answers  


What are local interfaces? Describe.

0 Answers  


Categories