public class Getxy {
public static void main(String[] args) {
int x, y;
find_result:
for (x = 1; x <= 9; x++) {
for (y = 1; y <= 9; y++)
if ((100 * x + 10 * x + y) + (10 * y + y) == (100 * y + 10 * x + x))
break find_result;
}
System.out.println("x: " + x + ", y: " + y);
}
}
코드를 위와 같이 짜니까 위에처럼 마지막 y에 빨간줄 쳐지면서 "The local variable y may not have been initialized"라고 오류가 뜨는데 C나 C++에서는 초기화 안 해줘도 오류 안 뜨지 않나요?