File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes what is this line mean: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "what is this line mean:" Watch "what is this line mean:" New topic

what is this line mean:

Tal Goldstein

Joined: Apr 16, 2006
Posts: 14
public class DelayQueue<E extends Delayed>

what the <> does?
and where can i read about it?

Vassili Vladimir
Ranch Hand

Joined: Mar 08, 2007
Posts: 1585

Check this.

Best of luck ...

Vassili ...
SCJP 5.0, SCWCD 1.4, SCJA 1.0
David Irwin
Ranch Hand

Joined: Mar 25, 2004
Posts: 82
As Vassili pointed out, the <> are used in Generics, a language addition in Java version 1.5. It essentially allows the developer to create type declarations. I have found this especially helpful in the Collections framework. For example before 1.5 you might do something like the following:

Notice that I have to cast the return object from an Object to an Item. In Java 1.5 and later you can declare a list of a specific type:

See how you don't need to cast from an Object to an Item. And it also prevents non-Item type objects from being added to the list. Type safety is generally increased.

You might also check out the following tutorial: tutorial.

I agree. Here's the link:
subject: what is this line mean:
It's not a secret anymore!