source file
A text file containing program code as a person writes it, such as Hello.java.
In more detail
In Java a source file ends in .java and a public class inside it must have the same name as the file. The compiler turns source files into class files; the JVM never reads source files, except through the single-file launcher. Source code is also what goes into version control.
Example
Hello.java holds public class HelloRelated terms
- class file — The file javac writes for each class, holding that class's bytecode plus a description of its fields and methods.
- javac — The Java compiler command, which reads .java source files and writes one .class file per class.
Taught in
- The Virtual Machine, The Kit And The Runtime — Modern Java: Virtual Threads & High-Throughput Services
- The Lifecycle Of A Java Program — Modern Java: Virtual Threads & High-Throughput Services