So i'm working on a program in Java, and whenever i run it, i get an error "Exception in thread "main" java.lang.NullPointerException". When i look at it closely, it appears that its caused by array of Reference Variables. Here's the code causing the problem:
public class agendafunctions {
static String input = "true";
agendaitem item[] = new agendaitem[5];
public agendafunctions() {
item[0].name = "one";
item[1].name = "two";
item[2].name = "three";
item[3].name = "four";
item[4].name = "five";
}
name is a variable in class agendaitem. From what i've read elsewhere, the error is caused by the program trying to use variables with a null value. But when i add a value, it says it can't convert from String or whatever to type agendaitem. Can anyone help?