Java学习Day07

2019-09-26  本文已影响0人  JayMeWangGL

今日学习内容总结


Date类


DateFormat类

DateFormat类是一个抽象类,可以用SimpleDateFormat来进行日期格式化


Calendar类

        Calendar c = Calendar.getInstance();
        System.out.println(c);
        int i = c.get(Calendar.MONTH)+1;
        System.out.println(i);
        Calendar c = Calendar.getInstance();
        c.set(Calendar.YEAR,2020);
        c.set(Calendar.MONTH,11);
        c.set(Calendar.DATE,12);
        int Year = c.get(Calendar.YEAR);
        int Month = c.get(Calendar.MONTH);
        int Day = c.get(Calendar.DATE);
        //同时设置年月日
        c.set(2019,5,12);
        c.add(Calendar.YEAR,-3);
        c.add(Calendar.MONTH,3);
        Date time = c.getTime();

System类

long l = System.currentTimeMillis();
        int[] array = {1,2,3,4,5,6,7,8,9,10};
        int[] copy ={9,8,7,6,5,4,3,2,1};
        System.arraycopy(array,0,copy,0,5);

StringBuilder类

字符串缓冲区,可以提高字符串的操作效率(可以看成一个可以变化的字符串)

        StringBuilder stringBuilder=new StringBuilder();
        stringBuilder.append("abbacb");
        System.out.println(stringBuilder);

包装类


上一篇下一篇

猜你喜欢

热点阅读