public class Person { private String firstName; private String lastName; public Person(String firstName, String lastName) { this.firstName = firstName; this.lastName = lastName; } public String getFirstName() { return this.firstName; } public String getLastName() { return this.lastName; } public String toString() { return "Person -- " + this.getFirstName() + " " + this.getLastName(); } }
public class Rectangle { private int width; private int height; public Rectangle(int w, int h) { this.width = w; this.height = h; } public int getWidth() { return this.width; } public int getHeight() { return this.height; } public String toString() { return "Rectangle -- " + this.getWidth() + " x " + this.getHeight(); } }