I am a newbie in objective programming so forgive me if this question is dumb.
I am developing a small to-do program as a exercise. But when I try to load existing txt file & folders for task storage, IDE told me Exception in thread "main" java.lang.NullPointerException
.
I read the popular one from this site describing this error, I kinda understood why it happened, but I just coudn't find the problem.
Line 17-26 of ListProcess:
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();
and yes, I'm using a class called ListItem to store these tasks.
ListItem class:
public class ListItem {
boolean isFolder=false;
String name;
String description;
String[] tags = new String[10];
Status status;
}