1 57 58 63 64 package addressbook.wsiftypes; 65 66 import java.io.Serializable ; 67 68 public class Phone implements Serializable { 69 70 private int areaCode; 72 private java.lang.String exchange; 73 private java.lang.String number; 74 75 public Phone () { } 77 78 public Phone (int areaCode, java.lang.String exchange, java.lang.String number) { 79 this.areaCode = areaCode; 80 this.exchange = exchange; 81 this.number = number; 82 } 83 84 public int getAreaCode() { 85 return areaCode; 86 } 87 88 public void setAreaCode(int areaCode) { 89 this.areaCode = areaCode; 90 } 91 92 public java.lang.String getExchange() { 93 return exchange; 94 } 95 96 public void setExchange(java.lang.String exchange) { 97 this.exchange = exchange; 98 } 99 100 public java.lang.String getNumber() { 101 return number; 102 } 103 104 public void setNumber(java.lang.String number) { 105 this.number = number; 106 } 107 108 public boolean equals(Phone rhs) { 109 return this.areaCode == rhs.getAreaCode() 110 && this.exchange.equals(rhs.getExchange()) 111 && this.number.equals(rhs.getNumber()); 112 } 113 114 public String toString() { 115 return "areaCode=" + areaCode + "\n" + 116 "exchange=" + exchange + "\n" + 117 "number=" + number; 118 } 119 120 } 121 | Popular Tags |