Question: The following program contains a few blanks ( A - E ) . The program models a library where different types of items such as
The following program contains a few blanks AE The program models a library where different types of items such as books and journals can be borrowed. Each library item has an ID and a title. The system should be expandable to allow the addition of more types of library items in the future. Fill in the blanks for the correct execution of the program. Your program should compile and run without any errors, and it should produce the following output: Book borrowed: "Effective Java"Journal borrowed: "Nature Journal, September marks Java code:abstract class LibraryItem private final String id; private final String title; LibraryItemString id String title this.id id; this.title title; void borrowItem System.out.printlnA borrowed: title ;Fill A to print the class name using Reflection API methods String getId return id; String getTitle return title; class Book extends LibraryItem BookString id String titleBid title; class Journal extends LibraryItem JournalString id String titleCid title; public class Main public static void mainString args LibraryItem book new Book "Effective Java"; LibraryItem journal new Journal "Nature Journal, September ; D; call the borrowItem E; call the borrowItem
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
