本帖最后由 官珺伟 于 2014-5-6 17:05 编辑
楼主,请看代码:
package day02;
import java.util.*;
public class PrintArray {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int [] a={1,2,3};
String[] str={"abc","qze"};
Object[] obj={a,str,"qqs"};
/*
for(int x=0;x<a.length;x++){
System.out.print(a[x]);
}
System.out.println();
for(int x=0;x<str.length;x++){
System.out.print(str[x]+",");
}
System.out.println();
for(int x=0;x<obj.length;x++){
System.out.print(obj[x]+",");
}
*/
for(int i:a){
System.out.print(i);
}
System.out.println();
for(String s:str){
System.out.print(s+",");
}
System.out.println();
for(Object o: obj){
System.out.print(o+"!");
}
}
}
|