Skip to content

Instantly share code, notes, and snippets.

@rajeevprasanna
Created January 19, 2014 06:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rajeevprasanna/8501351 to your computer and use it in GitHub Desktop.
Save rajeevprasanna/8501351 to your computer and use it in GitHub Desktop.
return type of overriding methods
package legalReturnTypes.overriding;
public class Alpha {
Alpha doStuff(char c) {
return new Alpha();
}
}
package legalReturnTypes.overriding;
public class Beta extends Alpha {
Beta doStuff(char c) { //return type Beta is sub class of Alpha
return new Beta();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment