public class  helloworld
{
public static void main(String[] args) 
{
System.out.println("Hello World!");
System.out.println(args[0]);
}
}这样可以的

解决方案 »

  1.   

    args是个数组,呢怎么能输出呢?输出其中一个元素,比如args[0]public class  helloworld
    {
    public static void main(String[] args) 
    {
    System.out.println("Hello World!");
    System.out.println(args[0]);
    }
    }
      

  2.   

    你要输入进去,比如  java helloworld test_args
    他就显示test_args 出来。
      

  3.   

    可以输出数组的,只是你大概看不懂,他输出的实际上是数组保存的地值,例如:[Ljava.lang.String;@62eec8。而此时输出args[0]肯定会出错。此时你的数组尽管不是null,但是其长度为0,即里面没有一个元素,args[0]会报数组越界的错误。
      

  4.   

    楼上的说得对,你的在运行程序的时候,必须得输入参数才可以啊,比如
    hellworld a b c
    那么arg[0],arg[1],arg[2]就分别对应了 a,b,c,这样才能输出。