Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.totalbeginner.tutorial;
- public class Person {
- // Fields
- private String name; // This is the name of the person
- private int maximumBooks; // Max books person can check out
- // constructors
- public Person() {
- name = "unknown name";
- maximumBooks = 3;
- }
- // Methods
- public String getName() {
- return name;
- }
- public void setName(String anyName) {
- name = anyName;
- }
- public int getMaximumBooks() {
- return maximumBooks;
- }
- public void setMaximumBooks(int maximumBooks) {
- this.maximumBooks = maximumBooks;
- }
- public String toString() {
- return this.getName() + " (" + this.getMaximumBooks() + " books)";
- }
- }
Add Comment
Please, Sign In to add comment