2024年9月7日

摘要: public static void main(String[] args) { //实例化对象 LinkedList linkedList=new LinkedList(); //1添加元素 Student student=new Student("刘德华",20); Student studen 阅读全文
posted @ 2024-09-07 21:39 anonymity。 阅读(4) 评论(0) 推荐(0) 编辑
 
摘要: public static void main(String[] args) { //创建集合 //实例化对象 Vector vector=new Vector(); //1添加元素 vector.add("草莓"); vector.add("芒果"); vector.add("木瓜"); Syst 阅读全文
posted @ 2024-09-07 20:45 anonymity。 阅读(3) 评论(0) 推荐(0) 编辑

2024年6月2日

摘要: 特点:代表一组任意类型的对象,无序、无下标、不能重复。 方法: 1.boolean add(Object obj)添加一个对象 2.boolean addAll(Collection c)将一个集合中的所有对象添加到此集合中。 3.void clear()清空此集合中的所有对象。 4.boolean 阅读全文
posted @ 2024-06-02 11:18 anonymity。 阅读(3) 评论(0) 推荐(0) 编辑

2024年5月29日

摘要: System系统类,主要用于获取系统的属性数据和其他操作,构造方法是私有的。 public class Demo01 { public static void main(String[] args) { //方法1.arraycopy:数组的复制 //1.src:源数组 //2.srcPos:从哪个 阅读全文
posted @ 2024-05-29 18:59 anonymity。 阅读(4) 评论(0) 推荐(0) 编辑
 
摘要: public class Demo01 { public static void main(String[] args) { //创建一个Calendar对象 Calendar calendar =Calendar.getInstance(); //打印目前时间 System.out.println 阅读全文
posted @ 2024-05-29 12:53 anonymity。 阅读(4) 评论(0) 推荐(0) 编辑

2024年5月28日

摘要: Date Date表示特定的瞬间,精确到毫秒。Date类中的大部分方法都已经被Calendar类中的方法所取代。 时间单位: 1秒=1000毫秒; 1毫秒=1000微秒; 1微秒=1000纳秒; 未过时的方法: 1.方法after before 2.比较 compareTo(); 3.比较是否相等 阅读全文
posted @ 2024-05-28 11:09 anonymity。 阅读(5) 评论(0) 推荐(0) 编辑

2024年5月27日

摘要: 位置:java.math包中 作用:精确计算浮点数 创建方式:BigDecimal bd=new BigDecimal("1.0"); 注意:使用的时候选择字符串 方法: BigDecimal add(BigDecimal bd) 加法 BigDecimal subtract(BigDecimal 阅读全文
posted @ 2024-05-27 20:03 anonymity。 阅读(3) 评论(0) 推荐(0) 编辑
 
摘要: StringBuffer:可变长字符串,jdk1.0提供,运行效率满、线程安全。 StringBuilder:可变长字符串,jdk5.0提供,运行效率快、线程不安全。(单线程推荐使用) 效率:StringBuilder>StringBuffer>String //验证StringBuilder效率高 阅读全文
posted @ 2024-05-27 17:42 anonymity。 阅读(2) 评论(0) 推荐(0) 编辑
 
摘要: substring方法:截取指定位置的字符串 public class Demo06 { public static void main(String[] args) { String str="this is a text"; //1.将str中的单词单独提取出来 String []arr= st 阅读全文
posted @ 2024-05-27 15:20 anonymity。 阅读(5) 评论(0) 推荐(0) 编辑
 
摘要: public String replace(char oldChar, char newChar ) 将旧字符串替换成新的字符串 public String[] split(String str) 根据str作拆分 代码详情: public class Demo05 { public static 阅读全文
posted @ 2024-05-27 09:36 anonymity。 阅读(2) 评论(0) 推荐(0) 编辑