Test your knowledge
The
PartyWithHearable<T extends Sociable & Comparable<Sociable>, U extends Hearable>
line means:The generic type constraint specifies that
T
must implement either theSociable
orComparable<Sociable>
interfaces, andU
must implement theHearable
interface.The class is a subclass of the
Sociable
,Comparable<Sociable>
, andHearable
classes.The generic type constraint specifies that
T
must implement both theSociable
andComparable<Sociable>
interfaces, andU
must implement theHearable
interface.
Which of the following lines is equivalent to
PartyWithHearable<SocialLion, Smartphone>lionsParty = new PartyWithHearable<SocialLion, Smartphone>(nala, android);
in Java 9:PartyWithHearable<SocialLion, Smartphone> lionsParty = new PartyWithHearable<>(nala, android);
PartyWithHearable<SocialLion, Smartphone> lionsParty = new PartyWithHearable(nala, android);
let lionsParty = new PartyWithHearable(nala, android);
When...