Why public class are named same as source file in java.and Why non public class are not required to to have same file and class name
Asked
Active
Viewed 45 times
0
-
It's a design decision, mainly because a non-`public` class can't be accessed from outside the package so there's no need to make it trivial to find. – Jack Oct 10 '18 at 17:22
-
https://stackoverflow.com/questions/2134784/why-are-filenames-in-java-the-same-as-the-public-class-name – Raghvendra Kumar Oct 10 '18 at 17:23
-
https://stackoverflow.com/questions/10442758/why-must-a-java-file-have-the-same-name-as-its-public-class – Raghvendra Kumar Oct 10 '18 at 17:24
-
@RaghvendraKumar: Got any more? – Makoto Oct 10 '18 at 17:25
-
@Makoto no I think that's it. – Raghvendra Kumar Oct 10 '18 at 17:27