A good answer might be:

  • Source code file.
    • A text file in the Java language created by a programmer with a text editor.
  • Bytecode file.
    • A file of machine language for the Java virtual machine created by a Java compiler.

Example Source Program

Here is the source program (source file) from the previous chapter. The purpose of this program is to type the characters "Hello World!" on the monitor (not including the quote marks.)


class Hello
{
  public static void main ( String[] args )
  {
    System.out.println("Hello World!");
  }
}

The file should be named "Hello.java" to match the first line of the program. On many computer systems, the upper and lower case characters of the file name are important. On all computers, upper and lower case inside the program are important. The first line
class Hello
Says that this source program will define a class called "Hello". A class is a section of a program. Small programs often consist of just one class. (A better definition of "class" will be given later.) When the program is compiled, the compiler will make a file of bytecodes called "Hello.class".

Some classes contain many lines. Everything that makes up a class will be placed between the first brace ( { ) and the matching last brace ( } ).

The name of the class (and therefore the name of the file) is up to you, as long as the name is made of alphabetical characters and digits with no spaces, the first character is alphabetical, and the name is not already in use. There will be more exact rules later on. The source file should always end with ".java" in lower case.

QUESTION 2:

Here is the first line of a Java program:


class AddUpNumbers
  1. What should the source file be named?
  2. What will the compiler automatically name the bytecode file?

Click Here after you have answered the question