This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Typo. Should be "word2 = ". Since word2 is null when you call add(), you get a NullPointerException. That stack trace says the error happens at line 28 in your applet; so you look at line 28, and figure out what's wrong. [ May 01, 2005: Message edited by: Ernest Friedman-Hill ]
No problem. Let's analyze what the error message says.
The first line indicates that your program threw an NullPointerException (which you obviously already knew). The next line starts what is called the "call stack". This is the chain of method calls that lead up to the exception. The first line tells you that this exception was thrown from java.awt.Container.addImpl() which is in the standard Java API. Notice that it also indicates the source file name and line number. If you want to, you can look at the source code that comes with the JDK. At this point, we probably just want to find the problem with your own code, so let's continue. The next line tells you that Container.addImpl() was called from Container.add() which is again a method from the Java API. The third line finally gives us a method in your own code: Pretty.init(). Container.add() was called on line 28 in Pretty.java. So now what is line 28?
Well, it looks like I took to long to finish typing my response. EFH has already given you some more information. However, I thought I'd still submit my post so that you can understand the information that the error message gives you and hopefully track down these kinds of errors on your own next time.