Write a public
class Book
that has the following instance variables:
title
: a String
author
: a String
pages
: an int
representing the number of pagesYou should supply two constructors: one that takes three arguments to initialize all three fields, and another that
only takes two arguments and just initializes the title
and author
fields.
Additionally, you should supply getter methods getTitle
, getAuthor
, and getPages
that return the respective
fields.
You will need to prefix the class and constructors with public
. We will talk about what this means next time!
You're challenge is to write tests for this problem described above.
Stuck? You may find these lessons helpful: