由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - multiple classes in one file:revisted
相关主题
weird class definitionTo call main method from another class
Class not found?问个基本问题
请教一个简单的问题Why inner classes can access only local final variables?
multiple classes in one fileJar question
interesting问一简单的问题 关于import
extending generic class , but not mentioning its parameterized type?question on single thread & multithread
java reflecton question: how to represent a String[] class?请教大家:如何modify java code in order to compile
找不到HttpClient Classhelp: Double or BigDecimal
相关话题的讨论汇总
话题: class话题: public话题: revisted话题: file话题: classes
进入Java版参与讨论
1 (共1页)
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();

1 (共1页)
进入Java版参与讨论
相关主题
help: Double or BigDecimalinteresting
Re: [转载] Re: .jar文件是怎么产生的?extending generic class , but not mentioning its parameterized type?
Re: Put classes into different filesjava reflecton question: how to represent a String[] class?
Re: help: how does the class Model$5.class come?找不到HttpClient Class
weird class definitionTo call main method from another class
Class not found?问个基本问题
请教一个简单的问题Why inner classes can access only local final variables?
multiple classes in one fileJar question
相关话题的讨论汇总
话题: class话题: public话题: revisted话题: file话题: classes