由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - multiple classes in one file
相关主题
interestingEclipse 3.0 platform API doc?
Help: how to use Eclipse as C++ IDE in XP? (转载)Just found eclipse 3.01 doesn't support
java compilation question请帮忙看看这个编译错误
Help with Tomcat for Eclipse v1.03怎么样同时build两个xsd file
ant javac error in eclipse 3.0?能这样编网站吗?
也问一个Eclipse的问题eclipse how to remember a code location and jump back?
multiple classes in one file:revistedin eclipse EE , how to build a tomcat/web application?
Help!: tomcat classloading problem问个关于jar的问题.
相关话题的讨论汇总
话题: file话题: public话题: classes话题: class
进入Java版参与讨论
1 (共1页)
t*******t
发帖数: 105
1
i am a beginner. thanks!
the source file is Test.java
package test
public class Panda{
}
public class KungfuPanda {
}
I use eclipse and it wont compile this file.
i googled a page and it says if i change the KungfuPanda into a private clas
s, it will work. However, it didnt work.
is this a feature unique to eclipse or java?
thanks!
g*****g
发帖数: 34805
2
You can only have one public class in one file,
for your question, you probably want to keep them
in 2 files instead, with filename matches classname.

clas

【在 t*******t 的大作中提到】
: i am a beginner. thanks!
: the source file is Test.java
: package test
: public class Panda{
: }
: public class KungfuPanda {
: }
: I use eclipse and it wont compile this file.
: i googled a page and it says if i change the KungfuPanda into a private clas
: s, it will work. However, it didnt work.

t*******t
发帖数: 105
3
but i actually saw some examples, quoted.
is this a mistake? btw, those examples are from a chinese java book.

【在 g*****g 的大作中提到】
: You can only have one public class in one file,
: for your question, you probably want to keep them
: in 2 files instead, with filename matches classname.
:
: clas

g*****g
发帖数: 34805
4
Just do what I say, and save yourself some time.

【在 t*******t 的大作中提到】
: but i actually saw some examples, quoted.
: is this a mistake? btw, those examples are from a chinese java book.

t*******t
发帖数: 105
5
i think so. thanks!

【在 g*****g 的大作中提到】
: Just do what I say, and save yourself some time.
w*******o
发帖数: 6125
6
Inner class can be public, does that count
as two public class in one file?

【在 g*****g 的大作中提到】
: Just do what I say, and save yourself some time.
t*******t
发帖数: 105
7
yes, but no in my case which claims two non-nested classes.

【在 w*******o 的大作中提到】
: Inner class can be public, does that count
: as two public class in one file?

1 (共1页)
进入Java版参与讨论
相关主题
问个关于jar的问题.ant javac error in eclipse 3.0?
Simple Question About Eclipse也问一个Eclipse的问题
Eclipse load更改过的class file的问题multiple classes in one file:revisted
get full class nameHelp!: tomcat classloading problem
interestingEclipse 3.0 platform API doc?
Help: how to use Eclipse as C++ IDE in XP? (转载)Just found eclipse 3.01 doesn't support
java compilation question请帮忙看看这个编译错误
Help with Tomcat for Eclipse v1.03怎么样同时build两个xsd file
相关话题的讨论汇总
话题: file话题: public话题: classes话题: class