Code example 9-1 public interface Printable { public void print(); } public clas
ID: 654139 • Letter: C
Question
Code example 9-1
public interface Printable
{
public void print();
}
public class Printer
{
public static void printInvoice(Printable p)
{
System.out.println("Printing invoice...");
p.print();
}
}
public class Order implements Printable
{
public void print()
{
System.out.println("Order object");
}
}
public class Rental extends Transaction implements Printable
{
public void print()
{
System.out.println("Rental object");
}
}
(Refer to code example 9-1.) What happens when the code that follows is executed?
Rental rental = new Rental();
Printer.printInvoice(rental);
Explanation / Answer
solution:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.