<html><head> | |
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> | |
<title>Chapter 4. Autoboxing and Unboxing</title><link rel="stylesheet" href="aspectj-docs.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.44"><link rel="home" href="index.html" title="The AspectJTM 5 Development Kit Developer's Notebook"><link rel="up" href="index.html" title="The AspectJTM 5 Development Kit Developer's Notebook"><link rel="previous" href="generics-inAspectJ5.html" title="Generics in AspectJ 5"><link rel="next" href="autoboxing-in-aspectj5.html" title="Autoboxing and Join Point matching in AspectJ 5"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 4. Autoboxing and Unboxing</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="generics-inAspectJ5.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="autoboxing-in-aspectj5.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><h2 class="title"><a name="autoboxing"></a>Chapter 4. Autoboxing and Unboxing</h2></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="autoboxing.html#boxing-inJava5">Autoboxing and Unboxing in Java 5</a></dt><dt><a href="autoboxing-in-aspectj5.html">Autoboxing and Join Point matching in AspectJ 5</a></dt><dt><a href="autoboxing-and-method-dispatch.html">Inter-type method declarations and method dispatch</a></dt></dl></div><div class="sect1"><a name="boxing-inJava5"></a><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="boxing-inJava5"></a>Autoboxing and Unboxing in Java 5</h2></div></div><p> | |
Java 5 (and hence AspectJ 1.5) supports automatic conversion of | |
primitive types (int, float, double etc.) to their object equivalents | |
(Integer, Float, Double,...) in assignments and method and constructor | |
invocations. This conversion is know as autoboxing. | |
</p><p>Java 5 also supports automatic unboxing, where wrapper types | |
are automatically converted into their primitive equivalents if | |
needed for assignments or method or constructor invocations.</p><p>For example:</p><pre class="programlisting"> | |
int i = 0; | |
i = new Integer(5); // auto-unboxing | |
Integer i2 = 5; // autoboxing | |
</pre></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="generics-inAspectJ5.html">Prev</a> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right"> <a accesskey="n" href="autoboxing-in-aspectj5.html">Next</a></td></tr><tr><td width="40%" align="left">Generics in AspectJ 5 </td><td width="20%" align="center"><a accesskey="u" href="index.html">Up</a></td><td width="40%" align="right"> Autoboxing and Join Point matching in AspectJ 5</td></tr></table></div></body></html> |