自動裝箱和自動拆箱
public class BoxTest
{
public static void main(String[] args)
{
int a = 3;
Collection<Integer> c = new ArrayList<Integer>();
c.add(3);//將int類型的3轉換爲Integer類型並放到集合當中
c.add(a + 3);
for(Integer i : c)
{
System.out.println(i);//自動拆箱
}
}
}