Return Types



  • Overloaded methods can change return types; overridden methods cannot, except in the case of covariant returns.
  • Object reference return types can accept null as a return value.
  • An array is a legal return type, both to declare and return as a value.
  • For methods with primitive return types, any value that can be implicitly converted to the return type can be returned.
  • Nothing can be returned from a void, but you can return nothing. You're allowed to simply say return, in any method with a void return type, to bust out of a method early. But you can't return nothing from a method with a non-void return type.
  • Methods with an object reference return type, can return a subtype.
  • Methods with an interface return type, can return any implementer.