-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.1.7
-
generic
-
generic
Name: krT82822 Date: 04/11/99
Even when the main method in the appliation's main class is non-public (i.e., declared without public keyword,) the Java VM accepts it and invokes it without any error/warning messages. This behaviour seems a violation against the section 12.1.4 of The Java Language Specification, which says "The method main must be declared public, static, and void."
E.g., when Hello.java is
class Hello {
static void main ( String [] argv ) {
System.out.println( "Hello, world" );
}
}
current java command (or jre command) executes it successfully, although it should report the fact that the main must be declared as public.
(Review ID: 56812)
======================================================================
- duplicates
-
JDK-4155575 (launcher) main method should have to be public
-
- Resolved
-