Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible to have several classes in just one file in Eclipse?

Tags:

java

eclipse

Is it possible to have several classes in a single java file in Eclipse? Or must I really have each one in a different file?

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

like image 731
devoured elysium Avatar asked Mar 02 '10 19:03

devoured elysium


1 Answers

You can only have one public class per file, according to the Java spec (this is not Eclipse's rule). You can have inner classes, or static classes, in the same file as a public class.

like image 87
pkaeding Avatar answered Oct 20 '22 00:10

pkaeding