Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. public class GameEntry
  2. {
  3. private String name;
  4. private int score;
  5.  
  6. public GameEntry(String name, int score)
  7. {
  8. setName(name);
  9. setScore(score);
  10. }
  11.  
  12. public String getName()
  13. {
  14. return this.name;
  15. }
  16.  
  17. public void setName(String name)
  18. {
  19. this.name = name;
  20. }
  21.  
  22. public int getScore()
  23. {
  24. return this.score;
  25. }
  26.  
  27. public void setScore(int score)
  28. {
  29. this.score = score;
  30. }
  31.  
  32. public String toString()
  33. {
  34. return this.name + " , " + this.score;
  35. }
  36.  
  37. public static void main(String[] args)
  38. {
  39. GameEntry Kitz = new GameEntry("Kitz", 100);
  40. System.out.println(Kitz.toString());
  41. }
  42.  
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement