public class Book
extends java.lang.Object
| Constructor and Description |
|---|
Book()
Default constructor for class Book that sets default values for title
and author (empty String) and pages (0).
|
Book(java.lang.String title,
java.lang.String author,
int pages)
Sets values for title, author and pages to the values of the parameters.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getAuthor()
Retrieves the author field.
|
int |
getPages()
Retrieves the pages field.
|
java.lang.String |
getTitle()
Retrieves the title field.
|
void |
setAuthor(java.lang.String author)
Updates the author field.
|
void |
setPages(int pages)
Updates the title field.
|
void |
setTitle(java.lang.String title)
Updates the title field.
|
java.lang.String |
toString()
Retrieves a String representation of a Book object with the title, author
and number of pages.
|
public Book()
public Book(java.lang.String title,
java.lang.String author,
int pages)
title - the title of the Bookauthor - the author of the Bookpages - the number of pages in the Bookpublic void setTitle(java.lang.String title)
title - the title of the Bookpublic void setAuthor(java.lang.String author)
author - the author of the Bookpublic void setPages(int pages)
pages - the number of pages in the Bookpublic java.lang.String getTitle()
public java.lang.String getAuthor()
public int getPages()
public java.lang.String toString()
toString in class java.lang.Object