Question: Which method calls can be inserted at both (1) and (2), so that the following code will still compile? Select the two correct answers. (a)
Which method calls can be inserted at both (1) and (2), so that the following code will still compile?

Select the two correct answers.
(a) printSlogan();
(b) co.printSlogan();
(c) sl.printSlogan();
(d) Company.printSlogan();
(e) ISlogan.printSlogan();
// File: Company.java interface ISlogan ( String SLOGAN = "Happiness shared is happiness doubled!"; default void printslogan () { System.out.println (SLOGAN); } }, public class Company implements ISlogan { public static void main(String[] args) { Company co = new Company (); ISlogan s1 = co; // (1) INSERT THE METHOD CALL HERE. } } public void testSlogan () { Company co= new Company (); ISlogan s1 = co; // (2) INSERT THE METHOD CALL HERE. }
Step by Step Solution
There are 3 Steps involved in it
b and c The default instance method printSlogan is ... View full answer
Get step-by-step solutions from verified subject matter experts
