Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. package wildcodeschool.java06;
  2.  
  3. public class Wilder { // classe wilder
  4.  
  5. private String firstname; // attributs
  6. private boolean aware;
  7.  
  8.  
  9.  
  10. public Wilder(){ // constructeur permettant d'initialiser les attributs
  11.  
  12.  
  13. }
  14.  
  15. public Wilder (String firstname , boolean aware) {
  16. this.firstname = firstname;
  17. this.aware = false;
  18. }
  19.  
  20.  
  21. public void setfirstname(String firstname)// set et get de firstname
  22. {
  23. this.firstname = firstname;
  24. }
  25.  
  26. public String getfirstname()
  27. {
  28. return this.firstname;
  29. }
  30.  
  31.  
  32. public void setaware(boolean aware) // set et get de aware
  33. {
  34. this.aware = false;
  35. }
  36.  
  37. public boolean isaware()
  38. {
  39. return this.aware;
  40. }
  41.  
  42.  
  43. public String whoAmI() { // méthode instantanée
  44.  
  45. String etataware = "je suis aware";
  46. if (!this.isaware());
  47. return "Je m'appelle " + this.getfirstname()+ "et" + etataware + "."; // les setters ne renvoient rien
  48. }
  49.  
  50.  
  51.  
  52.  
  53. //return "Je m'appelle " + this.firstname+ " et je suis " + this.aware;
  54.  
  55.  
  56.  
  57. ///System.out.println("Je m'appelle "+this.firstname() +"et" + etataware);
  58. // TODO Auto-generated method stub
  59.  
  60.  
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement