简体   繁体   中英

What does <> mean in a classname?

My question is what does this:
<RecentActivity, RecentActivityController>

mean in this code:
public class RecentActivity extends AbstractActionActivity<RecentActivity, RecentActivityController>

Actually I want know the concept of the < and > operators. Clould someone give references to learn about them?

This is known as generics and here AbstractActionActivity is a generic class which accepts two parameters. For example, from the oracle tutorials:

public class Box<T> {
    // T stands for "Type"
    private T t;

    public void set(T t) { this.t = t; }
    public T get() { return t; }
}

As you can see, all occurrences of Object are replaced by T. A type variable can be any non-primitive type you specify: any class type, any interface type, any array type, or even another type variable.

You can learn further here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM