Write a complete class called Book that has private instance variables for the title and author of the book and the following methods:
- A default constructor that sets the title to “Untitled” and the author to “Anonymous”
- A two-argument constructor that initializes the author and title to the provided arguments.
- A public void method called display that displays the title, the word “by,” and the author. For example if the title is “The Handmaid’s Tale” and the author is “Margaret Atwood”, the method would display:
The Handmaid's Tale by Margaret Atwood
Reviews
There are no reviews yet.