public static void main (String args[])
{
System.out.println("共输入了"+args.length+"个参数");
System.out.println(args);
}
System.out.println(args);的输出结果为
------解决方案--------------------------------------------------------
- Java code
public static void main(String[] args) { String[] strings=new String[]{"字符1","字符2","字符3","字符4","字符5"}; for (String string : strings) { System.out.println(string); } }
------解决方案--------------------------------------------------------
- Java code
import java.util.Arrays;public class PrintArgs { public static void main(String[] args) { System.out.println(Arrays.toString(args)); }}