Before you can write a computer program, you must learn a set of rules that define how a computer program can be written. There are two sets of rules: syntax and semantics. Syntax defines the rules by which a program must adhere to be processed by the compiler. Semantics defines the logical rules that make a computer program do what you want it to.
The Java programming process is as follows:
You write a Java program and save it as a text file with the .java file extension.
The Java compiler reads your program and ensures that it is syntactically correct according to the rules of the language.
The Java compiler generates a new file with a .class file extension that contains byte-code instructions that will be later interpreted by a Java Virtual Machine (JVM).
A Java Virtual Machine interprets the byte-code and performs the instructions defined in it.
The results of the execution depend on the semantics of your program.
This chapter explains the basics of the Java programming language syntax.