And so, we open a door into the wonderful world of Java coding, and of course, the fascinating history of jolly ole England.

During the last Ice Age the British Isles were connected to the mainland of Europe.


To make this statement in Java you can use the code shown below:

  1. //This code prints a statement about English history.
  2. class Geograpy {
  3. public static void main(String[] args) {
  4. System.out.println("During the last Ice Age the Brittish Isles were connected to the mainland of Europe.");
  5. }
  6. }


You can cut and paste the code shown above or type the code into Notepad++. Typing the code is beneficial since you tend to think about what is happening as you are entering each line.

You can achieve the indenting shown in the example by clicking the tab key in Notepad++. Indenting makes your code easier to read and understand.


Java code

The list shown here explains what the lines of code mean.

  1. The // symbol is used to indicate that the code is a comment only. Comments help you and other programmers to understand the code.
  2. The class is the primary component in all of your Java files. The class must have capitals at the beginning of each word. Curly braces are required to surround the statements within the class. The name of your Java file must always be the same as the class name that you declare.
  3. This line automatically executes the code shown within its curly braces.
  4. This is the line that uses the "println" method to print the history statement.
  5. This curly brace closes the "main" method on line 3.
  6. This curly brace closes the class declaration on line 2.


When your code is complete: Click File then Save As and save the file to the folder that you created previously. Save the file as: I have saved the training file to c:\javamike.

Once you have the file saved, you can click the Command prompt icon in your task bar to open the Command prompt window.

Command Prompt Window

In the Command prompt window you can type: cd\ to get to the c:\ prompt. You can also type cd \filename to get to your folder. To get to the training folder I typed cd \javamike. If you type dir you will see a list of the files in the folder. You should see your file. If not, go back to Notepad++ and retry your save.

Before running the program you must compile the program into computer language. Type javac If you have errors in your code you will see error messages. Make the necessary corrections and try again. When you receive no errors, you are ready to run your program. Type dir</em/> and you should see a file named: Geography.class. This is the compiled file. You can now start the program by typing: java Geography.


The output will look like this:

c:\javamike>java Geography

During the last Ice Age the British Isles were connected to the mainland of Europe.


< Environment Migrations (strings) >