Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Generics in Java Generics in Java Generics Quiz

Why the answer is all of those?

Hi, i dont understand why the answer is all of theseto the question: Which of these objects can we pass in to the logPresentr method?

Is it because <P> extends Object?, like <T>? Tonnie Fanadez

2 Answers

Tonnie Fanadez
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Tonnie Fanadez
UX Design Techdegree Graduate 22,796 Points

Hi noob developer

It should be all of them.

Just remember in Java we can define our own classes type and give them whatever name we can think of. Sock is-a(n) Object because it extends/inherits from Object Class. Chocolate Class is-a Object. A collection of Amazon Gift Cards is also an Object since a Gift Card Type is-a child of the Object Super-class.

In short *All Java Class Types * inherit their properties from the Object Class.

In return Objects of the same type can be grouped together using Collections (*Lists, Sets, Maps or Queues *).

In Collection<T> T is just a placeholder and any child of Object Class can be inserted in between the diamond brackets.

Hi Tonnie Fanadez how are u? So am i right with my question or no?, <P> is like <T>, <P> its a placeholder and any child of Object?

btw How's the techdegree, what u learn there?

Tonnie Fanadez
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Tonnie Fanadez
UX Design Techdegree Graduate 22,796 Points

Hi noob developer

You're correct both <P> and <T> are the same, they are placeholders.

UX design is fantastic and it teaches how to be creative and lot of exposure across IT fields. I am liking it and will keep you posted.