Subtyping in Java

In Java:

String is a subtype of Object, because the String class is a subclass of the Object class.

int is not a subtype of Object, because none of Java's primitive types are subtypes of any reference type.

StringBuilder is not a subtype of String, because the StringBuilder class is not a subclass of the String class.

HashMap<Candidate,Double> is a subtype of Map<Candidate,Double>, because the HashMap class implements the Map interface and the type parameters match.

HashMap<Candidate,Double> is not a subtype of Map<String,Ballot>, even though the HashMap class implements the Map interface, because the type parameters do not match.

For debugging: Click here to validate.