Return Types on Overloaded Methods

Return Types on Overloaded Methods

Overloading is not much more than name reuse. The overloaded method is a completely different method from any other method of the same name. 

So if we inherit a method but overload it in a subclass, we are not subject to the restrictions of overriding,overload a method, remember, we must change the argument list.

The following code shows an overloaded method :

public class Foo{
void go() { }
}
public class Bar extends Foo {
String go(int x) {
return null;
}
}

By:UMANG
Date:2004-03-09 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related scjp1.5 chap6 Links

scjp1.5 chap6 interview questions and answers for experienced and fresher