+ 1

Why only one 'public class' for per source file?

2nd May 2017, 7:50 PM
Afif
Afif - avatar
5 ответов
+ 9
You can use a public class inside another: public class One { public class Two{ } } Anywho, having a single public class makes it easy for the compiler to find in the package. So as rule, there can only be one public outer class per file. I personally just have each class in its own file anyway. http://docs.oracle.com/javase/specs/jls/se7/html/jls-7.html#jls-7.6
2nd May 2017, 9:08 PM
Rrestoring faith
Rrestoring faith - avatar
+ 6
@Martin Taylor Nice investigation/finding about code playground.
2nd May 2017, 10:14 PM
Andrew Harchenko (Tomsk)
Andrew Harchenko (Tomsk) - avatar
+ 2
because it is easier to find stuff if you look at the project in your ide
2nd May 2017, 7:52 PM
Drauchris
Drauchris - avatar