I can compile just fine but when I try and run the program I get this message. Can someone please help me out with this. "Exception in
thread "main" java.lang.NullPointer.Exception
class BooksTestDrive {
public static void main(
String[] args) {
Books[] myBooks = new Books[3];
myBooks[0].title = "The Grapes of wrath";
myBooks[1].title = "The Java";
myBooks[2].title = "The
Java cookbook";
myBooks[0].author = "bob";
myBooks[1].author = "joe";
myBooks[2].author = "deb";
int x = 0;
while (x < 2) {
System.out.print(myBooks[x].title);
System.out.print("by");
System.out.print(myBooks[x].author);
x = x+1;
}
}
}