Register now or log in to join your professional community.
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.
No we can't the main function( method) is the start point of execution.