Wrapper type for eight basic data types in Java: Basic data type wrapper type Bytejava.lang.byte;shortjava.lang.short;intjava.lang.integer;longjava.lang.long ;floatjava.lang.float;double java.lang.double;booleanjava.lang.boolean; charjava.lang.character;/* to the Java.lang.Integer; type for example, to explain eight kinds of types. */public class integertest02{public static void main (String[] args) {// Gets the maximum and minimum values of type int System.out.println ("int min:" + integer.min_value); SYSTEM.OUT.PRINTLN ("int max:" + integer.max_value);//push byteSystem.out.println with int ("Byte min:" + byte.min_value); System.out.println ("Byte max:" + byte.max_value);//Create an object of type integer integer i1 = new integer ( //int--> integerinteger i2 = new integer), //("123"); String --> integersystem.out.println (I1); //10system.out.println (I2); //123//The following program compilation can be passed. However, it is reported as abnormal when running. Numeric formatting exceptions.//Although you can convert a string to an Integer type, the string must also be a "numeric string."//integer i3 = new Integer ("ABCD"); //numberformatexceptioninteger Common Method:public class intergertest{ public static void main (String[] args) { //int--" interger Basic Data Type-"reference data type interger i1=new integer (TEN); integer i1=integer.valueof (Ten); // int i2= I1.intvalue (); //string-->integer integer i3=new Integer ("ten"); integer i4=integer.valueof ("Ten"); //** string-("Int int i4=integer.parseint"); //*****string- >>double double i5=double.parsedouble ("30.111");//convert decimal of type int to 16 binary string s2 = integer.tohexstring (10); SYSTEM.OUT.PRINTLN (S2); //a//converts decimal of type int to 8 binary string s3 = integer.tooctalstRing (10); System.out.println (S3); //12 }}
This article is from the "Gaogaozi" blog, make sure to keep this source http://hangtiangazi.blog.51cto.com/8584103/1662485
wrapper classes in Java