你来看这个例子:
public class HelloWorld
{
public static void main(String[] ddd)
{
System.out.println("Hello!");
for (int i=0;i<ddd.length;i++)
System.out.println(ddd[i]);
}
}
public class HelloWorld
{
public static void main(String[] ddd)
{
System.out.println("Hello!");
for (int i=0;i<ddd.length;i++)
System.out.println(ddd[i]);
}
}
PUBLIC STATIC VOID MAIN(STRING ARGS[])
SYSTEM。OUT。PRINTLN{}
但也可用JAVA。APPLETVIEW
public class HelloWorld
{
public static void main(String[] ddd)
{
for (int i=0;i<ddd.length;i++)
System.out.println(ddd[i]);
}
}
的话.执行起来就象是echo函数
以下是编译成功后的
执行如下:
c:\helloworld hi!boysandgirls
hi!boysandgirls
希望我说的你能够明白.
欢迎来信交流.
synchronized strictfp final static public mian(String[] args) throws Throwable {}
其中 synchronized strictfp final 是可选的
在我用的jdk1.3中,不用public ,用private ,protected ,默认,都能正常运行的,而在 1.4 中就不行~~~
你用的话,就有关啦.
反正这个 String[] 是存在的,不是null.
* @file Test.java
* @author Fancy
*/public class Test { public static void main(String[] args) {
for (int i = 0; i < args.length; i++) {
System.out.println("[" + i + "] " + args[i]);
}
}}运行
java Test Hello everyone, "I am Fancy"输出结果是:
[0] Hello
[1] everyone,
[2] I am Fancy