Files with the extension JAVA are source code files in the Java programming language. Java files can contain the source code for entire programs or only parts, for example classes or functions, which are imported into another JAVA file.
JAVA files are just text files that can be processed by a JAVA compiler. They can be opened and edited in any text editor, but it is recommended to use editors with developer features such as syntax highlighting or an integrated development environment (IDE) for easier work.
Compiling a JAVA file results in a class file containing a so-called ByteCode as a result for each class (a programming construct). This bytecode is only executable in a Java Virtual Machine (JVM) or Java Runtime Environment (JRE). These JVMs and JREs are available on many platforms, so Java is considered a platform-independent programming language.