Arm
Arm

Reputation: 141

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?

Upvotes: 3

Views: 5265

Answers (1)

codingsplash
codingsplash

Reputation: 5075

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

Upvotes: 4

Related Questions