hi,
can any one explain me the following code. is this the example for overloading or overriding?
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,3
my question is overloading mathod is in the same class & overriding method in different class.
but here answer 2&3 which means overloading mathod in another class.can we do that? i was under impression that overloading method only occurs in same class.
can any one explain me?
Thanks
Ketu