JAVA+Agent学习day10

📅 2026/7/11 3:26:42
JAVA+Agent学习day10
今日学习BigIntegerBigDeciamlDateCalenderSimpleDateFormatJDK8的新日期类包装类StringBuilderStringBuffer正则表达式File对象BigInterger-通俗理解,超级大整数-对象,理论上可以说BigInteger是无限大的,常见的方法是:加 减 乘 除;BigDecimal-用来处理float和double类型,主要方法是加(add)减(subtract)乘(multiple)除(divide),除法可以有四舍五入的类型Date日期类,补充一个小知识:时间原点:1970年1月1日 0时0分0秒;常用方法就是settime-设置时间和gettime-获取时间的毫秒值calender用英文释义理解就好,就是一个抽象的日历类,主要方法get set add getTimeSimpleDateFormat-日期格式化类,可以实现date对象和字符串之间的互相转化,主要方法parse和formatJDK8的新日期类-LocateDate-年月日;LocateDateTime-年月日时分秒获取日期字段的方法-getxxx(),设置日期字段的方法withxxx()计算年月日时间差-period;计算精确时间差-durationDateTimeFormatter-日期格式化类包装类-基本类型对应的类装箱:将基本类型转成对应的包装类 拆箱:将包装类转成对应的基本类型基本类型和String之间的互转 定义javabean的时候,尽量把属性定义为包装类类形String类就是一个字符串(通俗理解) String的底层是一个final数组,所以String是不可以改变的String有两个扩展构造将byte或者char转化为String类型String的两种方法-判断两个字符串是否一致-equals和equalsIgnoreCase(忽略大小写)String有一个新特性- 这一对三引号不能再同一行中拼接效率-StringBuilderStringBufferString正则表达式:用于校验规则的一种字符串 校验字符串内容file类可以练习c语言的文件进行理解主要方法-构造,获取,创建,删除,判断,遍历绝对路径-带盘符相对路径-不带盘符百日大厂计划day10,大家一起加油!package com.study.demo.i_DateTimeFormatter; import org.junit.Test; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; public class Demo01DateTimeFormatter { Test public void test01(){ DateTimeFormatter dtf DateTimeFormatter.ofPattern(yyyy-MM-dd HH:mm:ss); LocalDateTime ldt LocalDateTime.now(); String time dtf.format(ldt); System.out.println(time); } Test public void test02(){ DateTimeFormatter dtf DateTimeFormatter.ofPattern(yyyy-MM-dd HH:mm:ss); String time 2020-06-09 09:09:09; //TemporalAccessor temporalAccessor dtf.parse(time); //System.out.println(temporalAccessor); //LocalDateTime localDateTime LocalDateTime.from(temporalAccessor); //System.out.println(localDateTime); LocalDateTime localDateTime LocalDateTime.parse(time, dtf); System.out.println(localDateTime); } }