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?
|
|