ArrayList list = new ArrayList(); list.add(1); list.add(\"Java\"); list.add(3.14); System.out.println(list.toString());
It's not safe to do that! Imagine if you had:
ArrayList list = new ArrayList(); list.add(new Employee("Jonh")); list.add(new Car("BMW","M3")); list.add(new Chocolate("Twix"));
It wouldn't make sense to convert the list of those Objects to any type.