The following code get's an error when compiled. I know it's missing something but I just can't figure out what.
public class Books {
    String title;
    String author;
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Books[] myBooks = new Books[3];
        myBooks[0].title = "Learn Java";
        myBooks[1].title = "Java Development";
        myBooks[2].title = "Java Today!";
        myBooks[0].author = "S";
        myBooks[1].author = "Mr. S";
        myBooks[2].author = "SN";
        int x = 0;
        while (x < myBooks.length) {
            x = x + 1;
            System.out.print(myBooks[x].title);
            System.out.print(" by ");
            System.out.println(myBooks[x].author);
        }
    }
}
 
    