- What You Need to Write Programs
- Creating the Splash Program
- Beginning the Program
- Storing Information in a Variable
- Saving the Finished Product
- Compiling the Program into a Class File
- Fixing Errors
- Running a Java Program
Compiling the Program into a Class File
Before you can run a Java program, you must compile it. When you compile a program, the instructions given to the computer in the program are converted into a form the computer can better understand.
NetBeans compiles programs automatically as they are saved. If you typed everything as shown in Listing 4.2, the program compiles successfully.
A compiled version of the program, a new file called Splash.class, is created. All Java programs are compiled into class files, which are given the .class file extension. A Java program can be made up of several classes that work together, but in a simple program such as Splash only one class is needed.
The compiler turns Java source code into bytecode, a form that can be run by a Java Virtual Machine (JVM).