随笔分类 - Java学习基础
走的再慢也是在前进的路上
摘要:类变量: Static String name; 实例变量: String name = "chy"; 局部变量: 在普通方法里面 public Static method(){ int i = 0; } 常量: 被final修饰的变量值不可改变
阅读全文
摘要:0b开头即可 int a = 0b100111;int b = 2_1234_567;System.out.println(a); \\39System.out.println(b);\\21234567
阅读全文
摘要:String String是引用数据类型 equals() 比较两个字符串的内容 equalsIgnoreCase() 忽略字符串大小写比较内容 "word".contains("wo") 是否包含子字符串 "word".indexOf("w") 字符在索引第几位 "wword".lastIndex
阅读全文
摘要:向上转型 Person 父类 Student 子类 Student student = new Student() Person p1 = student ok Object o1 = student ok Object o2 = student ok 向下转型 Person p = new Stu
阅读全文
摘要:public class Main { public static void main(String[] args) { double d = 3.1415926; System.out.printf("%.2f\n", d); // 显示两位小数3.14 System.out.printf("%.
阅读全文
摘要:\" 表示字符" \' 表示字符' \\ 表示字符\ \n 表示换行符 \r 表示回车符 \t 表示Tab \u#### 表示一个Unicode编码的字符 String s = "ABC\n\u4e2d\u6587"; // 包含6个字符: A, B, C, 换行符, 中, 文
阅读全文
摘要:整数型: byte short int long 浮点型: float double 字符类型: char 布尔类型: boolean 引用数据类型(字符串): String
阅读全文

浙公网安备 33010602011771号