ArrayList

import java.util.ArrayList;

ArrayList<Integer> arrayList1 = new ArrayList<>();
ArrayList<String> arrayList2 = new ArrayList<>();
ArrayList<Double> arrayList3 = new ArrayList<>();

ArrayList 메소드

ArrayList 출력

// rect 인스턴스의 배열 생성 
		**ArrayList**<Rectangle> rects = **new ArrayList<>();**

// 반복문으로 가로 세로 길이 입력
		while (true) {
			int width = scanner.nextInt();
			int height = scanner.nextInt();
			if (width == 0 && height==0) break;
			
			// rect 객체 생성
			Rectangle rect = new Rectangle(width,height);
			rects.add(rect);
		//rects.add(new Rectangle(width,height));
			
		}

// 각 객체의 인스턴스 변수값 출력 
		for (**Rectangle value: rects**) {
			System.out.println("가로 길이는: "+ value.getWidth());
			System.out.println("세로 길이는: "+ value.getHeight());
			System.out.println("넓이는 : "+ value.recMethod());
		}