Hello everyone, I'm studying
Java with the Head First Java book and currently am at the I/O chapter, so one of the exercises is to make a Quiz Card class, builder and player.
However, I'm having issues with the builder as, for some reason, the program is not being able to read the content in the JTextAreas where you type your desired question and answer, whenever I try to do anything with the data, it throws a NullPointerException at runtime, even if the field is not blank and even after putting a setText() just before it.
If anyone could give me any insight of what is going wrong, I'd really appreciate it as I wasn't able to find any iffy code (I might be wrong) or a way to make it work, trying everything in my still limited knowledge to fix it, such as the aforementioned setText(), checking if the problem was the button, etc.
Here's the code as provided in the book (and from what I've learned so far, it was supposed to work):
It also uses a separate QuizCard class, which anyone using the book should write on their own and mine's as such:
I've considered the possibility of the problem being with my class, however
testing everything by removing all instances where the separate class was called still gave me the exception, so it doesn't seem to be the problem (again, might be wrong).
Thanks in advance for any insights.