Java Inheritance And Types