package com.ctgu.java;
public class TestArray1 {
public static void main(String[] args) {
String[] strs = new String[4];
strs[0] = "AA";
strs[1] = "BB";
//strs[2] = "CC";
strs[3] = "DD";
for(int i = 0 ; i< strs.length;i++){
System.out.println(strs[i]);
}
// TODO Auto-generated method stub
int[] scores = new int[4];
scores[0] = 89;
scores[3] = 89;
for(int i = 0 ; i< scores.length;i++){
System.out.println(scores[i]);
}
byte[] scores1 = new byte[4];
scores1[0] = 89;
scores1[3] = 89;
for(int i = 0 ; i< scores1.length;i++){
System.out.println(scores1[i]);
}
float[] f = new float[3];
for(int i = 0 ; i< f.length;i++){
System.out.println(f[i]);
}
System.out.println();
char[] c = new char [3];
for(int i = 0 ; i< c.length;i++){
System.out.println(c[i]);
}
boolean[] b = new boolean[3];
for(int i = 0 ; i< b.length;i++){
System.out.println(b[i]);
}
System.out.println();
Person[] pers = new Person[3];
for(int i = 0; i < pers.length;i++){
System.out.println(pers[i]);
}
}
}
class Person {
}原文:http://9815936.blog.51cto.com/9805936/1600844