暑假学习记录16 常用API 2,基本类型包装类

(1)今天学习了Arrays和基本类型包装类
(2)明天看几个案例,继续往下学
(3)    1  Arrays类的常用方法    public static String toString(int[] a)  返回指定数组的内容的字符串表示形式

                       public static void sort(int[] a)      按照数字顺序排列指定的数组

      2  基本类型包装类      基本数据类型  包装类

                     int       Integer

                     char       Character     除了这两种,剩下的类型的包装类都是首字母大写

 

          Interger类  方法    public static Integer valueOf(int i)  返回表示指定的int值的Integer实例

                     public static Integer valueOf(String s)返回一个保存指定值的Integer对象String

        3  int和String的相互转换   1   int变String public static String valueOf(int i)  

                      2   String变int      1                String =100;

                                    Integer i=Integer valueOf(s);

                                         int x=i.intvalue();

                                    System.out.println(x);

                              2      int i=Integer.parseInt(s);

                                      System.out.println(i);

posted @ 2021-07-27 21:40  Cuora  阅读(57)  评论(0)    收藏  举报