Source of PetPair.java


  1: /**
  2:  Class whose privacy can be breached.
  3: */
  4: public class PetPair
  5: {
  6:   private Pet first, second;
  7:   
  8:   public PetPair(Pet firstPet, Pet secondPet)
  9:   {
 10:     first = firstPet;
 11:     second = secondPet;
 12:   }
 13:   
 14:   public Pet getFirst()
 15:   {
 16:     return first;
 17:   }
 18:   
 19:   public Pet getSecond()
 20:   {
 21:     return second;
 22:   }
 23:   
 24:   public void writeOutput()
 25:   {
 26:     System.out.println("First pet in the pair:");
 27:         first.writeOutput();
 28:     System.out.println("\nSecond pet in the pair:");
 29:         second.writeOutput();
 30:   }
 31: }