/* SimpleSubclasses/AntEater.java A very simple class, with one field added to superclass Animal: */ public class AntEater extends Animal { double tongueLength; // length of tongue // constructors AntEater () { // create with defaults provided weight = 2000.0; x = 10; y = 10; tongueLength = 1.0; } ////////////////////////////////////////////////////////////////////////// // lick // anteaters can lick... public void lick () { System.out.printf( "AntEater at x=%d, y=%d licking...\n", x, y ); } public void printSelf () { System.out.printf( "AntEater x=%d, y=%d, weight = %.2f, tongeLen = %.2f\n", x, y, weight, tongueLength ); } ///////////////////////////////////////////////////////////////////////////////// // accessors (getters/setters) public void setTongueLength ( double d ) { tongueLength = d; } public double getTongueLength () { return tongueLength; } }