Simple Java Program

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   go to next page        

Answer:

No. (If you got this question wrong, or don't even know what it asks, you need to study Chapter Four.)

Simple Java Program

Here is an example Java program. It is about as small as a Java program can be. When it runs, it writes Hello World! on the computer monitor. The details will be explained later.

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

This program can be created using a text editor such as the Notepad editor that comes with Windows. (Details later.) This source program is a text file saved on a hard disk. The file is named Hello.java.

A source program is a text file that contains a program (such as above) written in a programming language. Since it contains ordinary text (stored as bytes) it can not be directly executed (run) by the computer system. As a text file, you can print it, display it on the monitor, or alter it with a text editor.

QUESTION 2:

(Review of Chapter 4:) What are the two ways that a source program can be run on a computer system?