© Kishori Sharan 2017

Kishori Sharan, Beginning Java 9 Fundamentals, https://doi.org/10.1007/978-1-4842-2902-6_12

12. Wrapper Classes

Kishori Sharan

(1)Montgomery, Alabama, USA

In this chapter, you will learn:

  • About the wrapper classes in Java and how to use them

  • How to get primitive values from strings

  • How primitive values are automatically boxed into wrapper objects when needed

  • How wrapper objects are automatically unboxed into primitive values when needed

All classes in this chapter are a member of a jdojo.wrapper module, as declared in Listing 12-1.

Listing 12-1. The Declaration of a jdojo.wrapper Module
// module-info.javamodule jdojo.wrapper {    exports com.jdojo.wrapper;}

Wrapper Classes

In previous chapters, you learned that primitive and reference ...

Get Beginning Java 9 Fundamentals: Arrays, Objects, Modules, JShell, and Regular Expressions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.