?public class Test {
???? static int is[] = new int[5];??
???? static String[] arrs = new String[5];??
???? static Object[] objs = new Object[5];
???? static Boolean[] bo = new Boolean[5];
??
???? public static void main(String[] args) {??
???????? int n = 1;??
???????? for (int i : is) {??
???????????? System.out.print("is[" + n + "] = " + i + "; ");??
???????????? n++;??
???????? }??
???????? System.out.println();??
???????? n -= 5;// n=n-5;??
???????? for (String arr : arrs) {??
???????????? System.out.print("arrs[" + n + "] = " + arr + "; ");??
???????????? n++;??
???????? }??
???????? System.out.println();??
???????? n -= 5;// n=n-5;??
???????? for (Object obj : objs) {??
??
???????????? System.out.print("objs[" + n + "] = " + obj + "; ");??
???????????? n++;??
???????? }
???????? System.out.println();??
???????? n -= 5;// n=n-5;?
???????? for(Boolean boo :bo){
???????????? System.out.print("bo[" + n + "] = " + boo + "; ");??
???????????? n++;
???????? }
??
???? }??
?}
?
====Result结果:
is[1] = 0; is[2] = 0; is[3] = 0; is[4] = 0; is[5] = 0;
arrs[1] = null; arrs[2] = null; arrs[3] = null; arrs[4] = null; arrs[5] = null;
objs[1] = null; objs[2] = null; objs[3] = null; objs[4] = null; objs[5] = null;
bo[1] = null; bo[2] = null; bo[3] = null; bo[4] = null; bo[5] = null;