문제가 있습니다. 저의 강사는 JOptionPane을 입력하고 콘솔 출력을 사용하여 루프를 만들기를 원합니다. JOptionPane에 루프를 사용하고 콘솔을 통해 출력을 보내려면 어떻게해야합니까?JOptionPane Looping
int even = 0;
int odd = 0;
int e_e = 0;
int o_o = 0;
String a1 = JOptionPane.showInputDialog(null, "Type in 10 integer");
for (int counter = 0; counter < 10; counter++){
int a = Integer.parseInt(a1);
if (a % 2 == 0) {
even++;
e_e += a;
} else {
odd++;
o_o += a;
}
}
System.out.println("\n\nNumber of even numbers : " + even);
System.out.println("Number of odd numbers : " + odd);
System.out.println("Total of even numbers : " + e_e);
System.out.println("Total of odd numbers : " + o_o);
음, 그냥 루프 내부의'JOptionPane'에 전화를 넣어 필요한 인쇄 할 수 있습니까? 그런 다음 특정 프로그램을 변경하는 방법에 대한 명확한 조언을 드릴 수 있습니다. – Zabuza
사용자가 귀하의 질문에 답변 한 경우 답변을 수락하십시오 ([수락 : 어떻게 작동합니까?] (https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work)). 답변을 얻지 못했다면 StackOverflow의 중요한 부분입니다. 정말 고마워요. – Zabuza