A developer has written these supporting Java declarations:
class Service { } class Audit { } final class Receipt { }
Consider each candidate below independently. Each candidate is added separately to the supporting declarations in the same source file. Enter yes if it compiles or no if it does not.
class Courier extends Service { }
class SecureReceipt extends Receipt { }
class Combined extends Service, Audit { }
class Recursive extends Recursive { }
Unlock full course notes by signing up
Updating shared behavior without editing subclasses
A print shop uses the following Java code to calculate daily paper use. Each return value is a number of sheets. The multiplication in HandoutJob.dailySheets() represents two separate, identical print batches.
The shop changes only the body of PrintJob.sheetsFor() to:
All the code is then recompiled. Calculate the new return value of dailySheets() for one PosterJob, one HandoutJob, and one LabelJob. Also calculate the increase in their combined daily sheet count compared with the original code. Enter all four answers in sheets as exact integers.
Output order in a three-level constructor chain
The three Java classes below form an inheritance chain. A program creates one object with new Thermometer(); and prints nothing else.
Arrange the four lines of output in the order the program prints them, from first to last.