Advertisement
PeterSJC

Peter's first Java code on Eclipse

Apr 1st, 2015
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. package org.totalbeginner.tutorial; // https://www.youtube.com/watch?v=svJQu6LUSTs
  2.  
  3. public class Person {
  4. private String name; // Name of person
  5. private int maximumBooks; // How many books person can check out
  6.  
  7. public Person() { // Constructor
  8. name = "unknown name";
  9. maximumBooks = 3;
  10. }
  11.  
  12. public String getName() {
  13. return name;
  14. }
  15.  
  16. public void setName(String name) {
  17. this.name = name;
  18. }
  19.  
  20. public int getMaximumBooks() {
  21. return maximumBooks;
  22. }
  23.  
  24. public void setMaximumBooks(int maximumBooks) {
  25. this.maximumBooks = maximumBooks;
  26. }
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement