---
title: "(笔记)J2EE中如何运用Autoboxing/Unboxing--New Features of J2EE"
author: "danielhjd"
date: "2011-03-23T15:56:15Z"
tags: ["J#"]
categories: ["编程语言"]
slug: "j2ee-autoboxing-unboxing-new-features-of-j2ee"
draft: false
lastmod: "2011-03-23T15:56:15Z"
id: 972771
url: "https://danielhjd.iteye.com/blog/972771"
---

public static void boxing(){ \[color=red]（1）Autoboxing 装箱\[/color] int i=9; Integer o\_i=new Integer (i); \[color=red]（2）Unboxing 拆箱\[/color] int j=o\_i.intValue(); \[color=red]（3）利用list数组\[/color] List list=new ArrayList(); list.add(i); list.add(j); \[color=red]（4）在J2EE中直接可以调用o\_i 而无需Unboxing 拆箱\[/color] list.add(o\_i); Iterator it =list.iterator(); while(it.hasNext()){ System.out.println(it.next()); } } public static void main(String\[] args) { boxing(); }