ArrayList objArray = new ArrayList<String>();
objArray.add(new Person("Amit",20));
To make a code type safe you have to use the type parameter in both sides of the assignment. Since you want to add Person object into the ArrayList, the code should be
System.out.println(objArray);
In the println() method you are passing objArray of type ArrayList. Which actually calls the toString() method, returns the hashCode of the object. If you want a meaningful output for each object of the list, then you can achieve it as follows
[ August 16, 2007: Message edited by: Al Mamun ]