t*******t 发帖数: 105 | 1 I just built an example based on the example from Thinking in Java 2nd
The src file is named as MultiClassInOneFile.java
package prac;
class A{} //If i add the modifier public to this class, eclipse
wont com
pile it.
class B{}
public class MultiClassInOneFile{
public static void main(String[] args){
C c = new C();
c.callme();
}
}
class C{
public void callme() | t*******t 发帖数: 105 | 2 这个问题可能有点学究。。。因为正如goodbug所说,这样干不好,逻辑不清楚,inner
class还算有逻辑,但是这种multi classes的case确实不好。
编译之后的文件是
MultiClassInOneFile.class
所以根本无从想象其中还有别的class。
【在 t*******t 的大作中提到】 : I just built an example based on the example from Thinking in Java 2nd : The src file is named as MultiClassInOneFile.java : package prac; : class A{} //If i add the modifier public to this class, eclipse : wont com : pile it. : class B{} : public class MultiClassInOneFile{ : public static void main(String[] args){ : C c = new C();
|
|