Vehicle.java.html

  1  public class Vehicle
  2  {
  3     private int numberOfTires;
  4  
  5     public int getNumberOfTires() 
  6     {
  7        return numberOfTires; 
  8     }
  9  
 10     public void setNumberOfTires(int newValue) 
 11     { 
 12        numberOfTires = newValue;
 13     }
 14  
 15     public String toString()
 16     {
 17        return getClass().getName() + "[numberOfTires=" + numberOfTires + "]";
 18        // This is a good way of implementing toString in a superclass--see Special Topic 9.6
 19     }
 20  }