Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does class<P> mean in Java? [duplicate]

Possible Duplicate:
What does the <TYPE> in java mean?

Hello I came across this class while debugging , can someone give me pointers to what it means, please. Thanks.

class Something<P>{
 private P someVariable;
}

//what does <P> mean here? 

Thanks.

like image 425
David Prun Avatar asked Nov 30 '22 22:11

David Prun


1 Answers

This is a generic. It allows you to write code that works with different types.

Try this tutorial:

http://docs.oracle.com/javase/tutorial/java/generics/

like image 141
Mel Nicholson Avatar answered Dec 09 '22 13:12

Mel Nicholson