数组声明,分配, 赋值 int y[] = new int[3]; y[0] = 1; y[1] = 2; y[2] = 3; int[] x = new int[] {1,2,3}; int[] x = {1,2,3}; 二维数组 String[][] x = {{"00","01"},{"10","11"}}; String[][] y = new String[2][2]; y[0][0] = "00"
While 和 Do-While //while int i = 0; while (i < 10) { System.out.print(i++); } //do - while int i = 0; do { System.out.print(i++); } while ( i < 10 ); For 和 Foreach for (int i = 0; i < 10; i++){ System.out.print(i); } for (int k = 0, l = 10; k &l
组合吃烤串的各种方法 String a = "Hello"; String b = new String(" World"); //在循环里面的话要小心用 String c = a+b; // Hello World a += b; // Hello World String x = "Hello " + "World"; 比较字符串 boolean x = a.equals(b); // compares string bo
interface MyInterface { void exposed(); } class MyClass implements MyInterface { public void exposed() {} public void hidden() {} } public static void main(String[] args) { MyInterface i = new MyClass(); } 参考文献: Java Quick Syntax Reference by Mikael