java数组打印字符串方法
在Java中,可以使用循环遍历数组,并使用System.out.println()方法打印数组中的字符串。以下是一个示例代码:
public class ArrayPrinting {
public static void main(String[] args) {
String[] array = {"Hello", "World", "Java"};
for (int i = 0; i < array.length; i++) {
System.out.println(array[i]);
}
}
}
输出结果为:
Hello
World
Java
原文地址: https://www.cveoy.top/t/topic/h1JN 著作权归作者所有。请勿转载和采集!