What does (angle brackets) mean in Java?

后端 未结 6 1532
轮回少年
轮回少年 2020-11-22 05:12

I am currently studying Java and have recently been stumped by angle brackets(<>). What exactly do they mean?

public class Pool{
    public inter         


        
6条回答
  •  囚心锁ツ
    2020-11-22 06:04

    is called a generic type. You can instantiate an object Pool like this:

    PoolFactory pool = new Pool();
    

    The generic parameter can only be a reference type. So you can't use primitive types like int or double or char or other primitive types.

提交回复
热议问题