// CSE 142, Spring 2010, Marty Stepp // This file defines a new class of objects named Point. // The Point class is a "blueprint" for how each Point object works. import java.awt.*; // for Graphics public class Point { int x; // each Point object should have an int x int y; // inside it, and an int y. public void foo() { // Each Point object now has a foo method inside it. // This code is running "inside of" a particular Point object, // so it can directly access that Point object's data fields. System.out.println("I pity the foo! " + x + " " + y); } // Whatever Point object you call this method on, // this code will draw it on the screen. public void draw(Graphics g) { g.fillOval(x, y, 3, 3); g.drawString("(" + x + ", " + y + ")", x, y); } }