Pet.java 434B

123456789101112131415161718192021222324
  1. /**
  2. * Write a description of class Pet here.
  3. *
  4. * @author (your name)
  5. * @version (a version number or a date)
  6. */
  7. public class Pet
  8. {
  9. private String name;
  10. public Pet (String name) {
  11. this.name = name;
  12. }
  13. public String speak() {
  14. return "indeterminate noise";
  15. }
  16. public void setName(String newName) {
  17. this.name = newName;
  18. }
  19. public String getName() {
  20. return name;
  21. }
  22. }