About Lesson
- Java source file is a text file that contains Java code, typically with a
.java
file extension. • It serves as the input to the Java compiler (javac
), which translates the source code into bytecode. - Only one public class is allowed in one source file. Name of source file should be same as name of public class if public class is present.
- Source file can have any number of non-public classes. Non-public classes does not have any impact on naming of source file.
- If the source file consists of only non-public classes, then the file could have any name.