Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. package spaceStationRecruitment;
  2.  
  3. public class Astronaut {
  4. private String name;
  5. private int age;
  6. private String country;
  7.  
  8. public Astronaut(String name, int age, String country) {
  9. this.name = name;
  10. this.age = age;
  11. this.country = country;
  12. }
  13.  
  14. public String getName() {
  15. return name;
  16. }
  17.  
  18. public int getAge() {
  19. return age;
  20. }
  21.  
  22. public String getCountry() {
  23. return country;
  24. }
  25.  
  26. @Override
  27. public String toString() {
  28. return String.format("Astronaut: %s, %d (%s)",this.getName(),this.getAge(),this.getCountry());
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement