public class Book { // the constructor: this is called when you say ''new Book(...)'' // it gets two Strings and an int as ''arguments'' public Book(String t, String a, int y) { // the constructor assigns its arguments (it gow from ''new Book(...)'' // to variables that belong to class Book title = t; author = a; year = y; } // here are these variables that belong to class Book, they are // ''private'', they cannot be used by any code outside class Book private String title; private String author; private int year; // some more private variables: we want to know if a book is lend out // and by whom, for a new Book objects, the default values are given private boolean available = true; private String user = null; // cool :) // now we need some methods! // people might want to know things about a Book object. Since // we keep our variables private, we need to provide ''methods'' // for them to use! // note they don't get any arguments - the argument list is empty () public String getTitle() { return title; } public String getAuthor() { return author; } public int getYear() { return year; } public String getUser() { return user; } public boolean isAvailable() { return available; } // and here come the lendTo() and giveBack() methods! // note they don't return anything (return value is declared to be void) public void lendTo(String u) { user = u; available = false; } public void giveBack() { user = null; available = true; } }