ArrayLIst 하다보니 차이점 발견

Juju·2022년 10월 12일
0

public class Sample{
private ArrayList List = null
pricate List List2 = null
Sample(){
List = new ArrayList();
List2 = new ArrayList();

}

Cannot invoke "java.util.ArrayList.add(Object)" because "this.List" is null

이거 class 전역변수에 null치우면 되는데 그냥 List로 선언한건 에러 안나고 ArrayList로 선언한건 에러 나는데 그 이유가 이유가 머냐..

profile
수정중

0개의 댓글

관련 채용 정보