가슴은 객체와 같이 가슴 클래스 내에서 만들고 싶은 다른 클래스입니다. int가 될 ArrayList를 비롯하여 여러 값으로 선언하고 싶습니다.arrayList를 초기화하는 방법
이 형식을 올바르게 지정하려면 어떻게해야합니까? 어떤 도움을 주셔서 감사합니다!
올바르게 컴파일되지 않습니다.
Chest chest = new Chest(0,0,0, {0},false,false);
는 희망이 내가이 내가 그것을 해결하는 방법 다른 클래스
import java.util.*;
public class Chest
{
public ArrayList<Integer> idList;
public boolean closed;
public boolean opened;
public Chest(int xpos, int ypos, int numContents, ArrayList<Integer> idList, boolean opened, boolean closed)
{
this.closed = true;
this.opened = false;
}
}
의 ArrayList를
Chest chest = new Chest(0,0,0, new ArrayList<Integer>(),false,false);
감사합니다입니다
을 할 노력하고있어 의미가 있습니다 미차!
이 작업이 신속하고 간단하게 해결해 주셔서 감사합니다. – user1920076
Arrays.asList에 의해 반환 된 List는 크기를 재조정 할 수 없습니다. –