1. With the left mouse button pressed, drag the mouse across the contents of the program listing that is shown below. This will select the program listing. Then choose Copy from the Edit menu of your web browser to copy the program listing to the clipboard.
  2. Start your text editor and create a new file called Choose Paste to paste the contents of the program listing from the clipboard into the new file.
  3. Save the file to disk and begin answering the questions that are shown below.
  4. When you need to look at the model answer, click here.
  5. Click here to go back to the tutorials menu.

Program listing

// Copyright (C) 1998-2016 Davin Pearson
// Website:

class Human {

   // Properties of the class...
   public String name;

   // Constructor of the class...
   public Human(String aName) {
      name = aName;

   // Methods of the class...
   public String toString() {
      return "I am a human and my name is " + name;

class ArrayTest2 {

   public static void main(String[] args) {
      ArrayTest2 x = new ArrayTest2();

   public void doStuff() {

      // insert your code here:



// (1) In the doStuff method, define an array of three Human
// objects called threesome.

// HINT: This is almost identical to what you did to create
// the double array in question (2) of,
// except that the class Human appears in place of the type
// double.
// (2) Create three new Human objects with names Angus,
// Brian and Charles and assign them to the threesome array.

// HINT: Unlike question (3) of, you can't
// use a loop for this.

// (3) In the "doStuff" methodm, add a "for" loop to print
// out the three Human objects using each object's toString
// method.