Given:
interface Printable { void print (); } class Paper implements Printable { public void print (){ } }
You are creating a class that follows "program to an interface" principle.
Which of the following line of code will you most likely be using?.
Select 1 option
A. public Paper getPrintable (){ return new Printable (); }/*from www. j av a2s . c o m*/ B. public Paper getPrintable (){ return new Paper (); } C. public Printable getPrintable (){ return new Paper (); } D. public Printable getPrintable (){ return new Printable (); }
Correct Option is : C
Although not mentioned explicitly in the exam objectives, there are a few questions on this topic in the exam.