PRO_gramer

aluno

May 17th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.41 KB | None | 0 0
  1.  
  2. package estruturacaelum;
  3.  
  4.  
  5. public class Aluno {
  6. private String nome;
  7. public String getNome() { //retorna nome
  8. return nome;
  9. }
  10. public void setNome(String nome) { //muda nome
  11. this.nome = nome;
  12. }
  13. @Override
  14. public String toString() {//mostra lista
  15. return this.nome;
  16. }
  17. @Override
  18. public boolean equals(Object o) {//comparação entre os nomes
  19. Aluno outro = (Aluno)o;
  20. return this.nome.equals(outro.nome);
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment