Acquaintance eight basic data types of object-oriented wrapper class --Java base (25)

First, the sum

*     Eight basic data types of packaging: the basic data types encapsulation class (reference type)
  *     basic data types packaging
  *     byte          -   Byte
  *     Short         -   Short
  *     int           -   Integer
  *     Long          -   Long
  *     a float         -   Float
  *     Double        -   Double
  *     char          -   Character
  *     boolean       - Boolean

Second, the simple use of Integer

1. Comparison packaging type basic data type ==

 

 2. Create the way

        Integer integer1=1;
        Integer integer2=new Integer(1);

3. Conversion Value

        Integer1 Integer;
         int A =. 1 ; 
        String STR = ". 1" ; 
// int converted to Integer Integer1 = A;
// Integer to convert int A = integer1.intValue (); A = Integer1; // to assign int Integer type the words, JRE can do this yourself.
// String turn Integer Integer1 = Integer.valueOf (str);
// Integer switch String str = integer1.toString ();
// String -> int a = Integer.valueOf ( STR) .intValue (); // Integer.valueOf (STR) is the return value of type Integer. a = the Integer.parseInt (STR);// Integer.parseInt (str) return value is an int

 

Guess you like

Origin www.cnblogs.com/Unlimited-Rain/p/12535595.html