Other |
---|
1.4.0 beta2Fixed |
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
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) ======================================================================
|