Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

12. Here are some class definitions with questions that follow. interface MyInte

ID: 3553400 • Letter: 1

Question

12. Here are some class definitions with questions that follow.

interface MyInterface

{

            // Methods of MyInterface

}

public SomeClass implements MyInterface

{

            // All methods of SomeClass and MyInterface

}

SomeClass obj = new SomeClass( );

a.      MyInterface miobj = obj;

b.     SomeClass obj2 = miobj;

c.      miobj.aMethodOfSomeClass( );


C.    In statement c, an interface reference is trying to access a SomeClass class method that is not part of MyInterface. Is this legal? Explain.

Explanation / Answer

Find the code here : http://ideone.com/ovinmo