public class Understand_String_args
{
public static void main(String[] args)
{
System.out.printf("args[0] = %s
", args[0]);
System.out.printf("args[1] = %s
", args[1]);
System.out.printf("args[2] = %s
", args[2]);
}
}
输出结果:
java Understand_String_args Hello world myfriend!
args[0] = Hello
args[1] = world
args[2] = myfriend!