List myList = new ArrayList<
String>();
myList.add("Hi");
myList.add(12345);
myList.add(123.45);
System.out.println(myList);
I am little confuse with that, why this list can add all type of values, while we have defined that arraylist will contain only String.