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