> From: Martin Gainty [mailto:[EMAIL PROTECTED]
> Subject: Re: How do I ........?
>
> **********But wait a minute Im NOT supposed to get
> NullPointerException !!!!!***********
Of course you are - you continued to try to use a method of the null
object even after determining that it was null:
> if (in==null) System.out.println("This is when in ==
null");
> while( ( r = in.read(by)) != -1)
>
> How is it that (in==null) didnt evaluate true ?
It did, of course. Your previous output was thrown away when the
exception occurred and replaced by the error page.
To make it simpler, here's your original code inside a simple class.
Try running it.
class Dummy {
public static void main(String[] args) {
Object in = null;
try {
if (in == null) System.out.println("This statement will never be
executed as NullPointerException will be thrown");
} catch(NullPointerException npe) {
System.out.println("variable in has thrown NullPointerException so
something about that here");
}
}
}
Then take a programming class.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.
---------------------------------------------------------------------
To start a new topic, e-mail: [email protected]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]