Use the Java compiler to compile Java programs.
The Java compiler[1] is probably the most important tool in the Java 2 SDK because it is responsible for compiling Java source code into executable Java programs.
The Java compiler creates executable program code in a special format known as bytecode.
Most compilers for other programming languages generate native executable code, which is code that is created to run solely on a specific type of computer platform.
The Java compiler takes a very different approach by generating bytecode that can be executed on any platform that supports Java.
Compiling a Java applet
The file TicTacToe.java that ships with the Java SDK contains the source code for a demonstration Java applet that allows you to play Tic-Tac-Toe against the computer.
To compile this source code file into an executable applet with the Java compiler, you would issue the following command at a command-line prompt (which you will do in this
lesson's exercise):
Java is a case-sensitive programming language. This especially applies to the Java API, which consists of classes, methods, and variables that are all given case-sensitive names. Even the names of applets are case-sensitive, which means the name of the applet in the source code (DateTime) must match the name of the source code file (DateTime.java).
After issuing the javac command, the file TicTacToe.class will be created, which is the executable applet class file that is ready to be embedded in a Web page. Executable Java programs are stored in files with a .class file extension because they are comprised of classes .
A class defines data and methods and is a unit of organization in a Java program.
A class is an object-oriented programming construct that attempts to make the modeling of real-world objects in software much
more intuitive.
The Web page TicTacToe.html contains the embedded applet, and must be opened in a Web browser in order to run the applet.