Is it possible to have multiple classes in only one file in Eclipse?

Is it possible to have multiple classes in one java file in Eclipse? Or should I have them in another file?

Is it just something imposed by Eclipse, or does the Java compiler have something against having just one file?

+5
source share
6 answers

You can have only one public class for each file, according to the Java specification (this is not an Eclipse rule). You can have inner classes or static classes in the same file as the public class.

+10
source

Eclipse Java . , . -.

+3

Java ( Java), , , . , .

+1

( ) . , Java, Eclipse. , ++ Eclipse ++.

+1

. - .

0

All Articles