나는 식별자 사람이 나를 도와 줄 수 Java - 오류 : <identifier> 예상, 어떻게 해결할 수 있습니까?
newIntArray3 = addValues(StackA.pop(), StackB.pop());
주세요 예상 말하는이 오류 메시지가?
스택별로 스택을 사용하여 두 개의 숫자를 추가하고 스택을 사용하여 답변을 표시하고 싶습니다.
import java.util.*;
public class sandy {
public static void main(String[] args){
int[] newIntArray1 = new int[]{5,9,2};
int[] newIntArray2 = new int[]{4,7,5,6};
Stack StackA = new Stack();
Stack StackB = new Stack();
Stack StackC = new Stack();
StackA.push(newIntArray1[0]);
StackA.push(newIntArray1[1]);
StackA.push(newIntArray1[2]);
StackB.push(newIntArray1[0]);
StackB.push(newIntArray1[1]);
StackB.push(newIntArray1[2]);
StackB.push(newIntArray1[3]);
while (!StackA.empty() && !StackB.empty()) {
int[] newIntArray3 = new int[4];
@SuppressWarnings("unchecked")
newIntArray3 = addValues(StackA.pop(), StackB.pop());
int i=0;
while (i<=3);
StackC.push(newIntArray3);
i++;
}
System.out.println("result: " + StackC.pop() + StackC.pop() + StackC.pop() + StackC.pop());
}
public void addValues() {
int x , y = 0;
int addValues = 0;
addValues = x+y;
System.out.println(addValues);
}
}
'자바를 확인하시기 바랍니다! = javascript' –
왜이 태그는'javascript'입니까? – abhishekkannojia
while (i <= 3);'무한 루프가 나타납니다. 코드를 올바르게 게시하십시오. – abhishekkannojia