document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. /**
  2. * A class that maintains information on a book.
  3. * This might form part of a larger application such
  4. * as a library system, for instance.
  5. *
  6. * @author Steve
  7. * @version 1.0.1
  8. */
  9. public class Book
  10. {
  11.     // The fields.
  12.     private String author;
  13.     private String title;
  14.     private int pages;
  15.     /**
  16.     * Set the author and title fields when this object
  17.     * is constructed.
  18.     */
  19.     public Book(String bookAuthor, String bookTitle, int bookPages)
  20.     {
  21.         author = bookAuthor;
  22.         title = bookTitle;
  23.         pages = bookPages;
  24.     }
  25.        
  26.     public String getAuthor()
  27.     {
  28.         return author;
  29.     }
  30.    
  31.     public String getTitle()
  32.     {
  33.         return title;
  34.     }
  35.    
  36.     public void printAuthor()
  37.     {
  38.         System.out.println(author);
  39.     }
  40.    
  41.     public void printTitle()
  42.     {
  43.         System.out.println(title);
  44.     }
  45.    
  46.     public int getPages()
  47.     {
  48.         return pages;
  49.     }
  50.    
  51.     public void printDetails()
  52.     {
  53.         System.out.println("Title  :" + title);
  54.         System.out.println("Author  :" + author);
  55.         System.out.println("Page(s)  :" + pages);
  56.     }
  57.    
  58. }
');