This content has been marked as final. Show 2 replies
If you're getting a NullPointerException in the foo() method then the only possibility is that docstream is null. Are you stating that it isn't null based on some evidence, or on the assumption that the start() method completed successfully?
There can be quite a few reasons. Please post the full stack trace of the exception. Please also place strategic System.out.println()'s in your methods so we can see what is called when.
The timing of when the page starts loading, is fully loaded, the applet is init()-ed and start()-ed is not very predictable. As DrClap says, what is the evidence that docstream is non-null?