//声明 new String().var String s = new String(); //判空 方式1: 变量声明后,ifn; 方式2: s.null if (s == null) { } //判非空 方式1: s.notnull; 方式2: s.nn if (s != null) { } //遍历 list.for ArrayList<Object> list = new ArrayList<>(); for (Object o : list) { } //带索引遍历 从小到大: list.fori; 从大到小: list.forr for (int i = 0; i < list.size(); i++) { } for (int i = list.size() - 1; i >= 0; i--) { } //取反 success.not Boolean success = true; //success.not --> !success //条件判断 if success.if if (success) { } //强转 cast 方式1: name.cast --> (String)name; 方式2: name.castvar --> String name2 = (String) name; Object name = "xz"; String name1 = (String) name; String name2 = (String) name; //返回 return name.return --> return name; //return name;