
//Read the code following and ans the question.
A) will cause a compile time error.(Exception must be caught or thrown by main(String)).
B)will cause a compile time error for Class InInterfaceImpl.The method methodOne() be declared with throws Exception".
C)will cause no cmpile time error and print"I will never throw and Exception the screen".
D)Will cause a run time error.
Given ans:A.
In this case ,we but a instance of AnInterfaceImp(suber-class),the reference type is AnInterface(super-class),I think we when we call the method ,it prefer the instance type,while the variable it prefer the reference type,as a result above ,when we call the ai.methodOne() in main(String arg[]),it will not invoke the methodOne of supper-class.but when I compile ,it give me the error that the main(String arg[]) shoud caught or throws a throws execption statement.
[This message has been edited by Gong James (edited November 05, 2001).]
(Marilyn added code tags)
[This message has been edited by Marilyn deQueiroz (edited November 06, 2001).]