随笔分类 -  常用类

摘要:枚举:枚举指由一组固定的常量组成的类型 强烈建议当你需要定义一组常量时,使用枚举类型 枚举类的基本用法: 1.创建枚举类 2.枚举类的特点: ①枚举类在定义时使用enum关键字 ②使用enum定义的枚举类默认继承java.lang.Enum ③枚举类中所有实例都必须定义在第一行,默认添加public 阅读全文
posted @ 2020-03-25 17:11 showMeTheCodes 阅读(125) 评论(0) 推荐(0) 编辑
摘要:Math类作为常用类中的一个,一般情况下我们用的不是特别多,除非你是在特殊领域 若要用的话还是查看下api比较靠谱 1 public class MathTest { 2 public static void main(String[] args) { 3 //取绝对值 4 System.out.p 阅读全文
posted @ 2020-03-24 22:02 showMeTheCodes 阅读(122) 评论(0) 推荐(0) 编辑
摘要:一.Date类 1 一些主要的方法: 2 public class DateTest { 3 public static void main(String[] args) throws ParseException { 4 Date date = new Date(); 5 //输出当前时间 6 S 阅读全文
posted @ 2020-03-24 17:23 showMeTheCodes 阅读(181) 评论(0) 推荐(0) 编辑
摘要:可变字符串: StringBuffer:线程安全,效率低 StringBuilder:线程不安全,效率高 二者的api相同,区别就是StringBuffer定义的方法中加入了synchronized关键字 1 public class StringBufferDemo { 2 public stat 阅读全文
posted @ 2020-03-21 10:34 showMeTheCodes 阅读(115) 评论(0) 推荐(0) 编辑
摘要:一.包装类与基本数据类型比较 1 public class IntegerDemo { 2 public static void main(String[] args) { 3 4 int i = 10; 5 Integer ii = 10; 6 System.out.println(i == ii 阅读全文
posted @ 2020-03-20 17:12 showMeTheCodes 阅读(318) 评论(0) 推荐(0) 编辑
摘要:一.包装类 包装类:将基本类型封装到一个类中,包含属性和方法 使用:在使用过程中,会涉及到自动装箱和自动拆箱 装箱:将基本数据类型转换成包装类 拆箱:将包装类转换成基本数据类型 1 public class IntegerDemo { 2 public static void main(String 阅读全文
posted @ 2020-03-20 17:10 showMeTheCodes 阅读(276) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示