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?

// File: Company.java interface ISlogan ( String SLOGAN = "Happiness shared is

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

1 Expert Approved Answer
Step: 1 Unlock

b and c The default instance method printSlogan is ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java Programming 8th Questions!