我的東西有點困惑。我寫了一個小代碼片段。java的args數組中的main()方法混亂(空檢查)
import java.util.*;
class AA
{
public static void main(String args[])
{
if(args == null)
{
System.out.println("I am null");
}
else{
System.out.println(args);
}
}
}
這是一個簡單的測試。我雖然不是從傳遞作爲參數的命令行 什麼,但還是參數表是不爲空,這意味着JVM初始化爲 像String數組。爲什麼背後有任何具體原因?我很好奇 知道。任何指針都會有幫助。 謝謝, 本
[Args保證爲非null?](http://stackoverflow.com/questions/9605532/args-guaranteed-to-be-non-null),http://程序員。 stackexchange.com/questions/120355/is-it-better-to-return-null-or-empty-values-from-functions-method s-where-the-ret –