The class need not be public, but the main should be made public for the JVM
to invoke.  Remember JVM is a third-party class from your class and hence it
requires main() to be made public to access it and run it.  However, today
JVMs can use Java Reflection API and be able to run main() even if it is
private.  Hence, defining main() as private can work in some JVMs.  Have you
tested your program on various different JVMs?

Now I am just curious how defining private main() is related to EJB? For
testing? :)

--
Subra

Subramaniam S - Viveka Software Technologies Pvt. Ltd.
http://www.thinktankpartners.com/


> -----Original Message-----
> Date:    Fri, 8 Dec 2000 15:05:45 +0530
> From:    "Shyam Sankar S." <[EMAIL PROTECTED]>
> Subject: main()
>
> Hi
>
> All these days, I was thinking that the main method has to be made
> public.
>
> All books say that main is made public so that it is accessible
> globally. But no one calls the main method directly. So does it
> matter at all. It is just the entry point for execution.
>
> public class testing{
>     private static void main(String[] a){
>         System.out.println("Hi");
>     }
> }
>
> This one works perfectly.....


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

  • main() Shyam Sankar S.
    • Subramaniam S

Reply via email to