What are the eight basic types in the Java language? wrapper class type

Source: Internet
Author: User

Tag: CTE 16px Oat EOF Java method binary binary primitive type

Wrapper class type for eight basic types

BYTE byte

int Integer

Char Character

Short Short

Long Long

Boolean Boolean

float float

Double Double

1  Public classTest1 {2 3      Public Static voidMain (string[] args) {4         //TODO auto-generated Method Stub5         intb= -;6String c=integer.tobinarystring (b);7System. out. println (c);8System. out. println (integer.max_value);9System. out. println (integer.min_value);Ten         //There are four ways to convert type int to string type One         //method One: A         intn1= -; -String s1=""+N1; -System. out. println ("s1="+s1); the         //method Two: most commonly used  -         intN2= -; -String s2=string.valueof (n2); -System. out. println ("s2="+S2); +         //Method Three: -         intn3= -; +Integer i=NewInteger (n3); AString s3=i.tostring (); atSystem. out. println ("s3="+S3); -         //method Four: -         intn4= -; -String s4=integer.tostring (N4); -System. out. println ("s4="+S4); -         //type string into int in         //method One: -String str1=" -"; toInteger j=NewInteger (str1); +         intnum1=J.intvalue (); -System. out. println ("num1="+num1); the         //method Two: most commonly used  *String str2=" -"; $         intNum2=Integer.parseint (str2);Panax NotoginsengSystem. out. println ("num2="+num2); -     } the  +}

A binary conversion can only be converted to 0 to 36 binary

When using wrapper classes, when writing an integer x=null, a null pointer exception appears, and the workaround first determines whether it is null and then used.

What are the eight basic types in the Java language? wrapper class type

Related Article

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.