摘要:
public static void main(String[] args) { //实例化对象 LinkedList linkedList=new LinkedList(); //1添加元素 Student student=new Student("刘德华",20); Student studen 阅读全文
2024年9月7日
2024年6月2日
摘要:
特点:代表一组任意类型的对象,无序、无下标、不能重复。 方法: 1.boolean add(Object obj)添加一个对象 2.boolean addAll(Collection c)将一个集合中的所有对象添加到此集合中。 3.void clear()清空此集合中的所有对象。 4.boolean 阅读全文
2024年5月29日
摘要:
System系统类,主要用于获取系统的属性数据和其他操作,构造方法是私有的。 public class Demo01 { public static void main(String[] args) { //方法1.arraycopy:数组的复制 //1.src:源数组 //2.srcPos:从哪个 阅读全文
摘要:
public class Demo01 { public static void main(String[] args) { //创建一个Calendar对象 Calendar calendar =Calendar.getInstance(); //打印目前时间 System.out.println 阅读全文
2024年5月28日
2024年5月27日
摘要:
位置:java.math包中 作用:精确计算浮点数 创建方式:BigDecimal bd=new BigDecimal("1.0"); 注意:使用的时候选择字符串 方法: BigDecimal add(BigDecimal bd) 加法 BigDecimal subtract(BigDecimal 阅读全文
摘要:
StringBuffer:可变长字符串,jdk1.0提供,运行效率满、线程安全。 StringBuilder:可变长字符串,jdk5.0提供,运行效率快、线程不安全。(单线程推荐使用) 效率:StringBuilder>StringBuffer>String //验证StringBuilder效率高 阅读全文
摘要:
substring方法:截取指定位置的字符串 public class Demo06 { public static void main(String[] args) { String str="this is a text"; //1.将str中的单词单独提取出来 String []arr= st 阅读全文
摘要:
public String replace(char oldChar, char newChar ) 将旧字符串替换成新的字符串 public String[] split(String str) 根据str作拆分 代码详情: public class Demo05 { public static 阅读全文