Why is primitive type int changed to object Integer automatically when i put primitve type int to ArrayList in java?
ArrayList can only store objects. int is a primitive data type so it is "auto-boxed" to the object equivalent. This only happens as of Java 5, before that you had to box the Integer yourself.