
public class Book {
	
	private String title;
	private String author;
	
	public Book() {}
	
	public Book(String title, String author) {
		this.title = title;
		this.author = author;
	}
	public String getTitle() {
		return title;
	}
	
	public void setTitle(String title) {
		this.title = title;
	}
	
	public String getAuthor() {
		return author;
	}
	
	public void setAuthor(String author) {
		this.author = author;
	}
	
	public void showInfo() {
		
		System.out.println(title + ", " + author);
	}
	
}
import java.util.ArrayList;
import ch21.Book;
public class ArrayListTest {
	public static void main(String[] args) {
		
		ArrayList<Book> library = new ArrayList<>();
		
		library.add(new Book("태백산맥1", "조정래"));
		library.add(new Book("태백산맥2", "조정래"));
		library.add(new Book("태백산맥3", "조정래"));
		library.add(new Book("태백산맥4", "조정래"));
		library.add(new Book("태백산맥5", "조정래"));
		
		for (int i = 0; i < library.size(); i++) {
			library.get(i).showInfo();
		}
	}
}
태백산맥1, 조정래
태백산맥2, 조정래
태백산맥3, 조정래
태백산맥4, 조정래
태백산맥5, 조정래