JDK-4235155 : static void main(String args[]) works without public
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 1.2.1
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_nt
  • CPU: x86
  • Submitted: 1999-05-04
  • Updated: 1999-05-11
  • Resolved: 1999-05-11
Related Reports
Duplicate :  
Description

Name: vi73552			Date: 05/04/99


This compiles and runs without any error at runtime on JDK1.2.1
class L2 extends Object {
        static void main(String args[]) {
                System.out.println("L1 - main");
        }
}

In JDK 1.1, we get runtime error 
In class L2: main must be public and static.

1.2.1 documentation says 

12.1.4 Invoke Test.main

Finally, after completion of the initialization for class Test (during which other 
consequential loading, linking, and initializing may have occurred), the method 
main of Test is invoked. 

The method main must be declared public, static, and void. It must accept a 
single argument that is an array of strings.
(Review ID: 57782) 
======================================================================

Comments
WORK AROUND Name: vi73552 Date: 05/04/99 -NO- ======================================================================
11-06-2004