Which of the following methods can be legally inserted in place of the comment //Method Here ?
class Base{
public void amethod(int i) { }
}
public class Scope extends Base{
public static void main(
String argv[]){
}
//Method Here
}
1) void amethod(int i) throws Exception {}
2) void amethod(long i)throws Exception {}
3) void amethod(long i){}
4) public void amethod(int i) throws Exception {}
answer is 2 and 3. I think it should be only 3 because in super class method is not throw any exception. if I'm wrong can you please correct me?
Thanks,
Ashu