Professional Documents
Culture Documents
In a library system, you have the classes Author and Book. The Author class has a
method getName() to retrieve the author's name, and the Book class has a
method displayBookInfo() to display the book's title and author.
Now, you need to implement a book review system using an inner class called
Review inside the Book class. The Review class should have a method
displayReview() to display the review comments.
Create a Java program that models this library system, and demonstrate it by
creating an author, a book, and a review for the book in the LibraryApp class.
Display the book information and the review.
SOLUTION :
class Author {
Author(String authorName) {
this.authorName = authorName;
return authorName;
class Book {
this.title = title;
this.author = author;
class Review {
String review;
Review(String review) {
this.review = review;
book.displayInfo();
review.displayReview();
OUTPUT :