// A first attempt at a Point class: // Has state and behavior -- fields and methods // // It could use a lot more functionality here // in this class, like a way to print out a Point // better ways to create Points. We can also // add even more methods that let a client do // other common operations with Points public class Point1 { // state // fields int x; int y; // behavior // instance method // mutators public void translate(int dx, int dy) { x += dx; y += dy; } // accessors public double distanceFromOrigin() { return Math.sqrt(x * x + y * y); } }