private String owner;
private int size;
private boolean hatOn=false;
// Constructor to create a Hat object
public Hat(String person, int theSize) {
size = theSize; // Set the hat size
owner = person; // Set the hat owner
}
// Method to put the hat on
public void putHatOn() {
hatOn = true; // Record hat status as on
}
// Method to put the hat on
public void putHatOn() {
hatOn = false; // Record hat status as off
}
// Method to change the owner
public void changeOwner(String newOwner) {
owner = newOwner;
}
public void changeOwner(String newOwner) , podemos usar public void mudar(String newOwner), porque tem de ser assim???
// Method to get the hat size
public int getSize() {
return size; // Return the size of the hat
porque tem de ser public int getSize, pode ser public int tamanho??
ou o nome obdece a algum parametro ou regra?
