Question
Question 36 All objects have access to the methods of the ____________ class. 2 points Question 37 Code example 9-1 public interface Printable { public
Question 36 All objects have access to the methods of the ____________ class. 2 points Question 37 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.) Which of the following statements will definitely not compile? a. Rental rental = new Rental(); Printable p = rental; b. Printable p = new Printable(); c. Printable p = new Order(); d. Transaction t = new Rental(); 2 points Question 38 Which of the following statements is true? a. A class cant override the default methods of an interface. b. A class can implement multiple interfaces. c. An interface can inherit a class. d. An interface can define and use instance variables. 2 points Question 39 A class that ______________ an interface must contain methods for all abstract methods in the interface. Otherwise, the class must be declared as abstract. 2 points Question 40 When you code a class that implements an interface, most IDEs can a. generate the constants of the interface b. generate the declaration for the interface c. generate all of the method declarations for the methods defined by the interface d. throw an UnsupportedOperationException
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started