Common class one by one basic data type wrapper class (Wrapperclass) one by one byte short Nteger Long Float Double Character Boolean

Source: Internet
Author: User
Tags float double

Why do I need a wrapper class?

Java is supported across platforms. Can be run on the server or on the phone

Basic data types are more efficient in stacks

Wrapper classes convert data types to objects in the heap to facilitate operations

1 Package Cn.bjsxt.wrapperclass;2 /**3 * Wrapperclass Packaging class4 * Packaging class Location Lang package does not need to import5  * 6 * @author Administrator7  *8  */9  Public classTest01 {Ten      Public Static voidMain (string[] args) { One         //turn 1000 into an object AInteger i =NewInteger ( +); -          //the maximum value of an integer -System. out. println (integer.max_value); the         //In 16 binary notation -System. out. println (integer.tohexstring (i)); -         //converts a string to an integer assignment to I2 -Integer i2 = Integer.parseint ("123"); +System. out. println (I2); -         //+10 +System. out. println (i2+Ten); AInteger i3 =NewInteger ("233"); atSystem. out. println (i3); -Integer I4 = Integer.parseint (" -"); -System. out. println (i4); -         //number becomes string concatenation directly -String str = the+""; -System. out. println (str); in     } -}

Common class one by one basic data type wrapper class (Wrapperclass) one by one byte short Nteger Long Float Double Character Boolean

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.