// CSE 142, Summer 2008 (Marty Stepp) // This file defines a new type of objects named Point. public class Point { // Fields: // what contents should each Point object have? int x; int y; // EACH Point object has an int x and int y inside it. // Methods: // what behavior should each Point object have? // Shifts the x/y position of this Point by the given amounts. public void translate(int dx, int dy) { x = x + dx; // when I say 'x' or 'y' here, I'm referring to the x/y field y = y + dy; // of the Point object on which the method was called. } // EACH Point object has a hello() method inside it. public void hello() { System.out.println("Hello!"); } }