- 하위 클래스에서 상위 클래스를 상속할 때, 오버라이드 하는 메서드의 반환 타입이 상위 클래스의 반환 타입의 sub-type이어도 괜찮다는 것.
public class Producer { public Object produce(String input) { Object result = input.toLowerCase(); return result; } } public class IntegerProducer extends Producer { @Override public Integer produce(String input) { return Integer.parseInt(input); } }