Question 36 Objects Access Methods Class 2 Points Question 37 Code Example 9 1 Public Inte Q30592650

Question 36 All objects have access to the methods of the____________ class. 2 points Question 37 Code example 9-1 publicinterface Printable { public void print(); } public class Printer {public static void printInvoice(Printable p) {System.out.println(“Printing invoice”); p.print(); } } public classOrder implements Printable { public void print() {System.out.println(“Order object”); } } public class Rental extendsTransaction implements Printable { public void print() {System.out.println(“Rental object”); } } (Refer to code example9-1.) Which of the following statements will definitely notcompile? 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 thefollowing statements is true? a. A class can’t override the defaultmethods of an interface. b. A class can implement multipleinterfaces. c. An interface can inherit a class. d. An interfacecan define and use instance variables. 2 points Question 39 A classthat ______________ an interface must contain methods for allabstract methods in the interface. Otherwise, the class must bedeclared as abstract. 2 points Question 40 When you code a classthat implements an interface, most IDEs can a. generate theconstants of the interface b. generate the declaration for theinterface c. generate all of the method declarations for themethods defined by the interface d. throw anUnsupportedOperationException

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *