There is a qn from Marcus Green
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 {}
Correct ans are 2 & 3.Now my question is if I call
Scope s=new Scope();
s.amethod(10) ; //any integer
this will give as duplicate methos declaration error.So I feel the ans is none of the above. Any suggestion
Regards,
Shalini