001 /** 002 * Exercise 5.1 from the book 003 * 004 * @author Kristian Torp, torp (at) cs (dot) aau (dot) dk 005 * @version 1.0 006 */ 007 public class Exercise5_1 { 008 009 /** 010 * Constructor for objects of class Exercise5_1 011 */ 012 public Exercise5_1() { 013 System.out.println("Making an object"); 014 } 015 016 /** 017 * Creates an ArrayList without import java.util.*; 018 */ 019 public static java.util.ArrayList getList() { 020 java.util.ArrayList res = new java.util.ArrayList(); 021 for (int i = 0; i < 10; i++) { 022 res.add(new Exercise5_1()); 023 } 024 return res; 025 } 026 027 /** 028 * The main method that creates an ArrayList 029 */ 030 public static void main(String args[]) { 031 java.util.ArrayList a = Exercise5_1.getList(); 032 033 } 034 }