Week 1: Lab Document, 8/30


We will support the Eclipse Integrated Development Environment (IDE) for Java programming. The Eclipse IDE is available on all computers in the 301 MLH lab. It is also available free for downloading onto your home computers. I have downloaded the first item, Eclipse IDE for Java Developers, and have been successfully using it on my home computer that runs Windows XP. Here is a basic Eclipse Tutorial (in powerpoint) created by your TA, Fang Wang.

Problem: Here is a sequence of simple Java programs. Run these in Eclipse, examine the output, and understand how the programs work.

  1. HelloWorld.java. This is the classic "simplest" program one can write in Java. It shows you a bit of the structure of a Java program.
  2. PrintSquares.java. This illustrates for-loops and simple output statements.
  3. ReadNumbers.java. This shows a simple example of Java input statements.
  4. TwoDPoint.java. This shows how to define a class (called TwoDPoint) and TwoDPointTest.java shows how to define and use TwoDPoint objects.
  5. RandomTest.java. This shows the use of 1-dimensional arrays and the use of a random number generator. Java provides a class called Random (see documentation here) that provides a number of methods that can be used to generate random numbers.