package test;
/** * Desription: * @author *<br/>网站:《a href="http://www.crazyit.org">疯狂Java联盟</a> *<br/> */
public /** * 简单的测试Field */ protected String name; public { long binVall=16; binVall=binVall>>>2; System.out.println(binVall); System.out.println("hello world"); }
} |
package test; /** * Description: * <br/>网站:<a href="http://www.crazyit.org">疯狂 Java 联盟</a> * <br/>Copyright (c) , 2001-2012,Yeeku.H.Lee * <br/>This program is protected by copyright laws. * <br/>Program Name: * <br/>Date: * @author * @version 1.0 */ public /** * 简单测试 */ public public Test() {
}
} |
package test; public protected String name; public { String[] test; test=new String[4]; test[0]="疯狂Java讲义"; test[1]="轻量级Java EE 企业应用实战"; for(int i=0;i<test.length;++i) System.out.println(test[i]); }
} |
package test;
public public String[] test; test = new String[4]; test[0] = "疯狂Java讲义"; test[1] = "轻量级Java EE 企业应用实战"; test[2] = "疯狂Android讲义"; for (String book : test) System.out.println(book); } } |
package test;
public public int[] a = { 5, 7, 20 }; int[] b = new
System.out.println("b数组的长度为:" + b.length); for (int i = 0, len = a.length; i < len; ++i) { System.out.println(a[i]); } for (int i = 0, len = b.length; i < len; ++i) { System.out.println(b[i]); } b = a; System.out.println("b数组的长度为:" + b.length); } } |
package test;
public
public Person[] students;
students = new Person[2]; Person zhang = new Person(); zhang.age = 15; zhang.height = 158; Person lee = new Person(); lee.age = 16; lee.height = 161; students[0] = zhang; students[1] = lee; lee.info(); students[1].info(); students[0].info(); } }
class Person { public public
public System.out.println("我的年龄是:" + age + ",我的身高是:" + height); } } |
package test;
public
public int[][] a; a = new // 把a当成一维数组,查看每个数组元素的值 for (int i = 0, len = a.length; i < len; ++i) { System.out.println(a[i]); } a[0] = new a[0][1] = 6; for (int i = 0, len = a[0].length; i < len; ++i) { System.out.println(a[0][i]); }
} } |
package test;
import java.util.Arrays;
public
public int[] a = new int[] a2 = new //用来判断两个数组是否相等 System.out.println("a的数组和a2数组是否相等:" + Arrays.equals(a, a2)); int[] b = Arrays.copyOf(a, 6); System.out.println("a的数组和b数组是否相等:" + Arrays.equals(a, b)); //将一个数组转化为字符串 System.out.println("b数组元素为" + Arrays.toString(b)); Arrays.fill(b, 2, 4, 1); //对数组中的元素排序 Arrays.sort(b); System.out.println("b数组的无线为:" + Arrays.toString(b));
} } |