좋아, 그것은 여러 번, 아래 코드 루프 후 나는 새로운 객체의 새 이름을 만드는 문제가 있습니다 :for 루프에서 다르게마다라는 이름의 객체를 만들기
Whatever A1 = new Whatever();
Whatever A2 = new Whatever();
Whatever A3 = new Whatever();
Whatever A4 = new Whatever();
Whatever A5 = new Whatever();
Scanner input = new Scanner(System.in);
int in;
while (true) {
try {
in = Integer.parseInt(input.nextLine());
switch (in) {
case 1:
Whatever A6 = new Whatever();
/*
* Name A6 for the first time, then A7 for the second time the
* loop repeats and so on, until I decide to quite the loop
*/
break;
}
} catch (Exception e) {
System.out.println("Invalid #");
}
}
이유를 설명 할 수 있습니까? 이것은 Container-type 클래스를 잘 사용하는 것처럼 보입니다. – brycem