---
spec: JLS
title: "The Java Language Specification"
edition: "Java SE 11 Edition"
java_version: 11
chapter: "Chapter 5. Conversions and Contexts"
section: "5.1.8"
heading: "5.1.8. Unboxing Conversion"
parent: "5.1. Kinds of Conversion"
source: https://docs.oracle.com/javase/specs/jls/se11/html/jls-5.html#jls-5.1.8
id: "5.1.8"
url: https://jvm.obfuscated.software/jls/se11/5.1.8.html
raw: https://jvm.obfuscated.software/jls/se11/5.1.8.md
---

# 5.1.8. Unboxing Conversion

Unboxing conversion treats expressions of a reference type as expressions of a corresponding primitive type. Specifically, the following eight conversions are called the *unboxing conversions*:

- From type `Boolean` to type `boolean`
- From type `Byte` to type `byte`
- From type `Short` to type `short`
- From type `Character` to type `char`
- From type `Integer` to type `int`
- From type `Long` to type `long`
- From type `Float` to type `float`
- From type `Double` to type `double`

At run time, unboxing conversion proceeds as follows:

- If `r` is a reference of type `Boolean`, then unboxing conversion converts `r` into `r.booleanValue()`
- If `r` is a reference of type `Byte`, then unboxing conversion converts `r` into `r.byteValue()`
- If `r` is a reference of type `Character`, then unboxing conversion converts `r` into `r.charValue()`
- If `r` is a reference of type `Short`, then unboxing conversion converts `r` into `r.shortValue()`
- If `r` is a reference of type `Integer`, then unboxing conversion converts `r` into `r.intValue()`
- If `r` is a reference of type `Long`, then unboxing conversion converts `r` into `r.longValue()`
- If `r` is a reference of type `Float`, unboxing conversion converts `r` into `r.floatValue()`
- If `r` is a reference of type `Double`, then unboxing conversion converts `r` into `r.doubleValue()`
- If `r` is `null`, unboxing conversion throws a `NullPointerException`

A type is said to be *convertible to a numeric type* if it is a numeric type ([§4.2](4.2.md)), or it is a reference type that may be converted to a numeric type by unboxing conversion.

A type is said to be *convertible to an integral type* if it is an integral type, or it is a reference type that may be converted to an integral type by unboxing conversion.
