1 //字符串 2 3 String str = "a"; 4 5 char c = 'd'; 6 7 int j = 0; 8 9 String strl = new String("a bc bc a bc"); 10 11 char[] cc = {'a','b'}; 12 13 String str2 = new String(cc); 14 15 System.out.println("str2 = " + str2); 16 17 //连接字符串 18 19 System.out.println("strl + str2 + j = " + strl + str2 + (j + 300)); 20 21 //99乘法表 22 23 int[] a = new int[5]; 24 25 int l = a.length;//是属性 26 27 int g = strl.length();//是方法 28 29 System.out.println("strl.length() = " + g); 30 31 //查找 32 int sy = strl.indexOf("bc"); 33 34 System.out.println("strl.indexOf("bc") = " + sy); 35 36 int syl = strl.lastIndexOf("bc"); 37 System.out.println("strl.lastIndexOf("") = " + syl); 38 39 //取出字符 40 System.out.println("charAt = " + strl.charAt(2)); 41 42 //取出字符串 43 System.out.println("substring = " + strl.substring(3)); 44 45 System.out.println("substring = " + strl.substring(3,5));