Pessoal esse código esta correto? estou com dúvida no toString, pois deve-se usar “+nome+” ou seria “+getNome+” ?
Eu preciso fazer essa parte “public String getNome(){” ?
[code]public class Cliente extends PessoaFisica{
private boolean fumante;
/** Creates a new instance of Cliente */
public Cliente() {
}
public Cliente(String nome, String telefone){
this.nome = nome;
this.telefone = telefone;
}
public String getNome(){
return this.nome;
}
public String getTelefone(){
return this.telefone;
}
public String toString(){
return "Nome: " + nome + "Telefone: " + telefone + "Fumante: " + fumante;
}
public boolean equals(Object obj) {
Cliente cb = (Cliente)obj;
if (this.nome == cb.nome){
return true;
}
return false;
}
}[/code]
Obrigado