018-001-010
Combining Interface and Abstract Class
Easy
Problem Description
Combining Interface and abstract class
In this problem, you will create a program that implements a Report class combining a Printable interface and an AbstractDocument abstract class, then displays the title to standard output.
Learning Objective: Understand how to achieve flexible design by combining interfaces and abstract classes
Overview
Abstract classes provide common implementation while interfaces define capability contracts. Combining both enables highly reusable and flexible designs.
Specifications
- Define print() method in Printable interface
- Define title field and getTitle() method in AbstractDocument class
- Report class extends AbstractDocument and implements Printable
- print() displays "Report: " followed by title
Output Format
Title: Annual Report
Report: Annual Report
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up