auto binding (type inference) of generic types by the compiler

后端 未结 5 687
梦毁少年i
梦毁少年i 2021-01-24 01:11

the following code has compilation error in the line of t3:

public  List getList()
{
    return new ArrayList();
}
public  vo         


        
5条回答
  •  误落风尘
    2021-01-24 01:32

    The getList() method seems to be returning a new list each time which is initially empty. get(0) from an empty list will throw an IllegalArgumentException. This is a runtime error though so it may not be causing the compile error.

提交回复
热议问题