Home > Articles > Programming > Games

  • Print
  • + Share This
This chapter is from the book

Saving the Finished Product

Your program should now resemble Listing 4.2, although you might have used slightly different spacing in Lines 5–6. Make any corrections that are needed and save the file (by selecting the menu command File, Save).

LISTING 4.2 The Finished Version of the Splash Program

1: package com.javaminecraft;

2:

3: class Splash {

4:     public static void main(String[] arguments) {

5:         String greeting = “Blue warrior shot the food!”

6:         System.out.println(greeting);

7:     }

8: }

When the computer runs this program, it runs each of the statements in the main statement block on Lines 5 and 6. Listing 4.3 shows what the program would look like if it was written in the English language instead of Java.

LISTING 4.3 A Line-by-Line Breakdown of the Splash Program

1: Put this program in the com.javaminecraft package.

2:

3: The Splash program begins here:

4:     The main part of the program begins here:

5:         Store the text “Blue warrior shot the food!” in a String named greeting

6:         Display the contents of the variable greeting

7:    The main part of the program ends here.

8: The Splash program ends here.
  • + Share This
  • 🔖 Save To Your Account