Question: Assignment: Imagine you're developing a digital library system, which includes a base class Book with properties title ( String ) and pages ( int )

Assignment: Imagine you're developing a digital library system, which includes a base class Book with properties title (String) and pages (int), along with their respective public getters getTitle() and getPages(). You are tasked with creating a subclass named Ebook that extends Book. This subclass adds an additional property, format (String), representing the ebook's format (e.g.,"PDF", "ePUB").
Construct a variable named digitalRead of type Ebook, and instantiate it with an Ebook object that has the title "Advanced Java", 350 pages, and is in the "PDF" format. Assume the Ebook subclass has a constructor Ebook(String title, int pages, String format).
Secondly, write a statement to declare an int variable named objectPages and set it to the attribute pages of the digitalRead object (don't use the hardcoded value 350 here, but access the object property).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!