-
Bug
-
Resolution: Fixed
-
P3
-
1.0, 1.1.7, 1.2.0, 1.2.1, 1.2.2, 1.3.0
-
beta2
-
generic, x86, sparc
-
generic, solaris_2.4, solaris_7, windows_95, windows_98, windows_nt
In 1.2Beta4 it is no longer required that the main method of an application
be public. This is true for both java and oldjava, and is an incompatible
change from 1.1.
Name: tb29552 Date: 09/06/99
/*
see,
I had written a simple application with the main method as
*/
public class psvm {
private static void main(String[] args) {
System.out.println("works ");
}
}
/*
Can you tell me how the jvm can call the private method main.
I did it under 1.1.x and it reports an error:
"In class psvm: main must be public and static"
but under 1.2.. it just executed and gave the output.
*/
(Review ID: 94901)
======================================================================
Name: rmT116609 Date: 02/21/2001
output is fine...but how is private main() method is getting inherited
Could any one please explain that how private main() method is getting
inherited in DerivedClass from BaseClass, you can save the below mentioned
code as DerivedClass.java and run as java DerivedClass, the output is "This
is Base Class main. I am using jdk1.3.
// File: DerivedClass.java
class BaseClass {
private static void main(String[] a){
System.out.println("This is Base Class main");
}
}
public class DerivedClass extends BaseClass {
}
(Review ID: 117419)
======================================================================
be public. This is true for both java and oldjava, and is an incompatible
change from 1.1.
Name: tb29552 Date: 09/06/99
/*
see,
I had written a simple application with the main method as
*/
public class psvm {
private static void main(String[] args) {
System.out.println("works ");
}
}
/*
Can you tell me how the jvm can call the private method main.
I did it under 1.1.x and it reports an error:
"In class psvm: main must be public and static"
but under 1.2.. it just executed and gave the output.
*/
(Review ID: 94901)
======================================================================
Name: rmT116609 Date: 02/21/2001
output is fine...but how is private main() method is getting inherited
Could any one please explain that how private main() method is getting
inherited in DerivedClass from BaseClass, you can save the below mentioned
code as DerivedClass.java and run as java DerivedClass, the output is "This
is Base Class main. I am using jdk1.3.
// File: DerivedClass.java
class BaseClass {
private static void main(String[] a){
System.out.println("This is Base Class main");
}
}
public class DerivedClass extends BaseClass {
}
(Review ID: 117419)
======================================================================
- duplicates
-
JDK-4154504 VM let to declare main() without public keyword.
- Closed
-
JDK-4228581 JDK 1.2 VM accepts non-public main method as the primary entry (1.1 OK)
- Closed
-
JDK-4235155 static void main(String args[]) works without public
- Closed
-
JDK-4334677 private static void main(String args[]) executes fine without reporting problems
- Closed