Java11---包装类型

    技术2024-08-22  64

    1:每一个基本类型都对应一个包装类型 long->Long int->Integer short->Short btye->Byte double->Double float->Float boolean->Boolean 2:基本类型和包装类型的转换 法一: Interger a=new Interger(10); int b=a.intValue(); 法二: Integer k=123; int m=k; 例子:

    package my; public class Hello { public static void main(String[] args) { String str="123"; int a=Integer.valueOf(str); String s=String.valueOf(339); System.out.println("the result:"+a); System.out.println("the result:"+s); } } /* the result:123 the result:339 Process finished with exit code 0 */
    Processed: 0.012, SQL: 9