Exercise 0        Name __________________        Score __/8

Use BlueJ and the editor to find out the answers:

  1. What is the name of the Triangle class?

    Triangle
     
  2. Give the Java code to create two Triangle objects named t1 and t2.

    Triangle t1 = new Triangle();
    Triangle t2 = new Triangle();

     
  3. How many fields are there in a Triangle object?

    6
     
  4. What is the default color of a Triangle?

    "green"
     
  5. How many methods are there in a Triangle object?

    12
     
  6. Give the one line of Java code to:
    1. use the erase method on t1 Triangle object.

      t1.erase();

      is the obvious answer but... because erase() is private:

          private void erase()

      cannot use outside the Triangle class definition nor does erase() appear on the list of Triangle methods in BlueJ.
       
    2. move t2 Triangle object vertically a distance of 20.

      t2.moveVertical(20);
       
    3. change the color of t2 Triangle object.

      t2.changeColor("red");