int type Integer object and converting the same manner as other basic type conversion.

int corresponds Integer , char corresponding Character , the other 6 one all basic types the first letter capitalized .

parseXXX (String s); where XXX represents the basic type, parameters can be converted into a string of basic types.

System.out.println(Integer.parseInt("123") + 2);

// print the results to 125

// string -> basic data types
        String str = "12"; // string when the string must be an integer
        int num = Integer.parseInt (str); // class name directly modulated
        double num2 = Double.parseDouble (STR);
        System.out.println (NUM +. 1);
        System.out.println (num2);
        // basic types -> string
        System.out.println ( "" + + 12 is. 1);
        string string S1 = .valueOf (88);
        
        String S2 = String.valueOf (1.2);
        System.out.println (S1 +. 1);
        
        System.out.println (S2 +. 1);
        
        String Integer.toString S3 = (99);
        the System. out.println (s3 + 1);

Guess you like

Origin www.cnblogs.com/G-qz/p/10929869.html