日期:2014-05-20  浏览次数:20717 次

初级java怎么打印数组的值不是内存地址
public class T1 {
public static void main(String[] args) {
String[] str={"1","2","3","4","5","6","7","8","9","99","999","999","9999"};
System.out.println(str);
}
}


------解决方案--------------------
Java code
String[] str={"1","2","3","4","5","6","7","8","9","99","999","999","9999"};
        for(int i=0;i<str.length;i++)
        {
            System.out.println(str[i]);
        }
        for(String s:str)
        {
            System.out.println(s);
        }

------解决方案--------------------
System.out.println(java.util.Arrays.toString(str));
------解决方案--------------------
探讨
public class T1 {
public static void main(String[] args) {
String[] str={"1","2","3","4","5","6","7","8","9","99","999","999","9999"};
System.out.println(str);
}
}