摘要: 类变量: Static String name; 实例变量: String name = "chy"; 局部变量: 在普通方法里面 public Static method(){ int i = 0; } 常量: 被final修饰的变量值不可改变 阅读全文
posted @ 2021-12-06 09:59 流樱。 阅读(30) 评论(0) 推荐(0)
摘要: 0b开头即可 int a = 0b100111;int b = 2_1234_567;System.out.println(a); \\39System.out.println(b);\\21234567 阅读全文
posted @ 2021-11-08 17:10 流樱。 阅读(38) 评论(0) 推荐(0)
摘要: String String是引用数据类型 equals() 比较两个字符串的内容 equalsIgnoreCase() 忽略字符串大小写比较内容 "word".contains("wo") 是否包含子字符串 "word".indexOf("w") 字符在索引第几位 "wword".lastIndex 阅读全文
posted @ 2021-11-04 17:38 流樱。 阅读(30) 评论(0) 推荐(0)
摘要: 向上转型 Person 父类 Student 子类 Student student = new Student() Person p1 = student ok Object o1 = student ok Object o2 = student ok 向下转型 Person p = new Stu 阅读全文
posted @ 2021-10-26 15:36 流樱。 阅读(34) 评论(0) 推荐(0)
摘要: public class Main { public static void main(String[] args) { double d = 3.1415926; System.out.printf("%.2f\n", d); // 显示两位小数3.14 System.out.printf("%. 阅读全文
posted @ 2021-10-18 17:31 流樱。 阅读(261) 评论(0) 推荐(0)
摘要: \" 表示字符" \' 表示字符' \\ 表示字符\ \n 表示换行符 \r 表示回车符 \t 表示Tab \u#### 表示一个Unicode编码的字符 String s = "ABC\n\u4e2d\u6587"; // 包含6个字符: A, B, C, 换行符, 中, 文 阅读全文
posted @ 2021-10-18 17:01 流樱。 阅读(454) 评论(0) 推荐(0)
摘要: 整数型: byte short int long 浮点型: float double 字符类型: char 布尔类型: boolean 引用数据类型(字符串): String 阅读全文
posted @ 2021-10-18 16:43 流樱。 阅读(102) 评论(0) 推荐(0)