Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Can we execute a java program without main function?

user-image
Question added by Salman Ahmed , SAP ABAP S4-HANA Consultant , Deloitte - India
Date Posted: 2015/08/18
Mohammad Hakim
by Mohammad Hakim , Technical Head , Middle East Technologies

Yes and NO..

Yes, we can execute if we run the program in a container such as Servlet container (Tomcat etc)..

 

No (not if we closely look into containers), because the servlet container need to be running and it wouldn't be started unless there is a main class (Bootstrap if you refer catalina start script) which is started again using java command..

 

in case of a standalone "java program" the answer is NO.

Eyuel Shewarga
by Eyuel Shewarga , Software Developer , Maraki Soft Technologies

No we can't the main function( method) is the start point of execution.

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.