Javaでnullポインタ例外コーディング

青;

私はこの質問がダムである場合ので、私を許して客観的プログラミングで初心者です。

練習として、プログラムを実行するには、私は小さなを開発しています。私は、タスクのストレージのための既存のtxtファイル&フォルダをロードしようとする。しかし、IDEは私に言いましたException in thread "main" java.lang.NullPointerException私はこのエラーを説明する、このサイトから人気のあるものを読んで、それはなぜ起こったか、私はちょっと理解が、私はちょうどcoudn't問題を見つけます。

ListProcessのライン17-26:

public ListItem[] loadList() throws FileNotFoundException {
        ListItem[] listitem = new ListItem[200];
        int listCount=0;
        for (String txts : loadTxtsList()) {
            File file = new File(txts);
            Scanner scanner = new Scanner("List/"+file);
            listitem[listCount].isFolder = false;
            listitem[listCount].name = txts.replace(".txt", "");
            listitem[listCount].description = scanner.nextLine();
            int i = scanner.nextInt();

はい、私はこれらのタスクを格納するのListItemと呼ばれるクラスを使用しています。

ListItemクラス:

public class ListItem {
    boolean isFolder=false;
    String name;
    String description;
    String[] tags = new String[10];
    Status status;
}
アンドロニカス:

次の行:

ListItem[] listitem = new ListItem[200];

その項目すべてある配列を作成しますnull

おすすめ

転載: http://43.154.161.224:23101/article/api/json?id=340338&siteId=1