search
HomeJavaJavagetting StartedBoxing and unboxing in java

Boxing and unboxing in java

Nov 28, 2019 pm 04:20 PM
javaUnboxing

Boxing and unboxing in java

#1. What is boxing? What is unboxing?

Boxing: The process of converting a basic type into a wrapper type.

Unboxing: The process of converting a wrapper type into a basic type.

Online learning video sharing: java online tutorial

2. What is the execution process of boxing and unboxing

Boxing is achieved by calling the valueOf method of the wrapper class;

Unboxing is achieved by calling the xxxValue method of the wrapper class, xxx represents the corresponding basic data type.

For example: the valueOf(int) method of Integer is automatically called when int is boxed; Integer is automatically called when unboxing##intValue method of #Integer.

3. Frequently Asked Questions

(1) Integer packaging class

valueOf When the method returns an object, within the commonly used value range, The cache object will be returned.

(2) Floating-point wrapper class

valueOf method returns a new object.

(3) Boolean wrapper class

valueOf method BooleanStatic constant of class TRUE | FALSE.

More related articles and tutorials are recommended:

Getting started with java development

The above is the detailed content of Boxing and unboxing in java. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:CSDN. If there is any infringement, please contact admin@php.cn delete

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version