5.操作符 public class Test{ public static void main(String[] args){ int i, k; i = 10; /*下面一句话的意义是:假如i小于零,k就等于-i,否则k就等于i*/ k = i < 0 ? -i : i; // get absolute value of i System.out.print("Absolute value of "); System.out.…
一般this在各类语言中都表示“调用当前函数的对象”,java中也存在这种用法: public class Leaf { int i = 0; Leaf increment(){ i++; return this; //this指代调用increment()函数的对象 } void print(){ System.out.println("i = " + i); } public static void main(String[] args) { Leaf x = new Leaf()…