2017-03-20 1 views
0

편집을 2 차원 배열을 추가합니다.은 배열의 배열 목록에

shapeList.add(drawBoxClassObject.drawBox(l)); 

여기서 drawBoxClassObject.drawBox (l);

no suitable method found for add(String[][]) 
method Collection.add(String) is not applicable 
    (argument mismatch; String[][] cannot be converted to String) 
method List.add(String) is not applicable 
    (argument mismatch; String[][] cannot be converted to String) 

이 어떻게 (필자는이 문자열로 변환 할 수 없습니다 해결하는 것입니다 생각) 1 차원 문자열 배열 내부의 2 차원 문자열 배열 자체를 저장할 수 있습니다 :이 줄 날이 오류를 제공, 2 차원 문자열 배열을 반환? 저장하려는 경우

List<String> shapeList = new ArrayList<>(); 

을하지만 :

답변

0

에에서 shapeList의 선언을 변경

drawBoxClassObject이면

List<String[][]> shapeList = new ArrayList<>(); 
0
당신의 오류가 shapeList이 같은 다소 초기화되는 것을 알 수

List<String> shapeList = new ArrayList<>(); 

List<String[][]> shapeList = new ArrayList<>(); 
0

이 작동합니다 : 변경 선언은 다음과 같은 2 차원 문자열 배열을 수락 당신은 문자열 [] []가 아닌 문자열을 가하고 있습니다

List<String[][]> shapeList = new ArrayList<String[][]>(); 

.