就是像這個教學 http://www.tutorialspoint.com/java/java_encapsulation.htm
寫個封裝的物件,
想說如果需要並且有必要設一個類似hashmap key唯一值,
假如 我有個Mac Address想把它設為唯一值需要怎麼做,
還是有其他觀念~
想請教各位大大!
public class EncapTest{
private String macAddress;
private String name;
public int getMacAddress(){
return macAddress;
}
public String getName(){
return name;
}
public void setMacAddress(String newAddress){
macAddress = newAddress;
}
public void setName(String newName){
name = newName;
}
}