Advertisement
Guest User

ciccio

a guest
Jan 17th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. package esercizio2;
  2.  
  3. public abstract class Alfabeto {
  4. private int valore;
  5.  
  6. public abstract Boolean uguale(Object x);
  7.  
  8. public void setValore(int valore) {
  9. this.valore = valore;
  10. }
  11.  
  12. public int getValore() {
  13. return valore;
  14. }
  15. }
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22. package esercizio2;
  23.  
  24. public class AlfaItalia extends Alfabeto {
  25. private String nome;
  26.  
  27. public AlfaItalia(int valore, String nome){
  28. this.nome = nome;
  29. setValore(valore);
  30. }
  31. @Override
  32. public Boolean uguale(Object x) {
  33.  
  34. return (((AlfaItalia)x).nome).equals(this.nome) && (((Alfabeto)x).getValore()).equals(this.getValore());
  35. //(this.getValore()) && ((AlfaItalia)x.).equals(this.nome);
  36. //public Boolean uguale(Object x) {
  37. //return (((AlfaItalia)x).nome).equals(this.nome)) && (((Alfabeto)x).getValore()).equals(this.getValore());
  38. //}
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement