Anyways, it happens at X***
for(j = 0; j < s.length; j++) {
X*** System.out.println(s[j].nextChar()); //****
System.out.println(s[j] == null);
}
I've tested to see wheather s[j] is null I got a false; so I take it as not
null. Any suggestions, I would post the entire code, but I am still unsure
how to validate date.
the only possible things that could be null and cause this exception are
s (which is clearly not the case, since s.length does not throw a NPE),
or s[j]. Are you SURE that s[j] isn't null? Because that's what it looks
like is the case.
> I've tested to see wheather s[j] is null I got a false; so I take it as not
> null. Any suggestions, I would post the entire code, but I am still unsure
> how to validate date.
--
Of making better designs there is no end,
and much refactoring wearies the body.
java is fun
j
false
Exception in thread "main" java.lang.NullPointerException
at vertical.main(vertical.java:39)
Press any key to continue . . .
"Benji" <b...@cc.gatech.edu> wrote in message
news:dkph65$57b$1...@news-int.gatech.edu...
wow, you're the second person to think that my attribution line wasn't
just a joke, and both of you have @shaw.ca e-mail addresses. maybe it's
a canadian thing.
"while high on whiteboard markers" appears before all of my replies.
Anywho, e-mail me your code with the test in it. I'd like to look at
all of it.
well, wait a second. you put the check to see if it == null *after*
you access it - that means that s[1] is null - just not s[0].
Roedy, seriously...I think it's funny 'cause it's random and silly. I
smile when I see people with random attribution lines. "while sitting
on a big fluffy tiger", "while eating a bowl of cereal", "while
saving the world from supervillians", "while sitting on the toilet"...
do you really think that "coughed up" is offensive? I don't understand
that.
I set this as my attribution line like 3 years ago, and have had exactly
two people (you and this gentleman) say anything about thinking that it
was an offense to them. I don't even remember how to change it back,
and I didn't have any motivation until he posted. Your response to me
was wholly snobbish, rude, and insulting, and this is the tone you've
carried in every single e-mail you've sent me, including replies to my
apologies.
Which is more offensive? My attribution line (which is very obviously
a joke), or you?
> Benji is a smart Alec little brat who thinks it is funny to insult
> strangers.
I've never thought of it as an insult; and since the previous poster
thought it was an insult, I will change my attribution line as soon as
I find the setting in tin.
I didn't take you seriously when you first commented because I thought
you were trolling, since it didn't seem like you had any reason to lash
out at me like you did. Maybe in the future, it would help if you
resorted less to insults when you're upset with someone.
try printing out the check for null before you call nextChar.
this is not true. it's printing false, then going to the *NEXT* iteration
of the loop, and then throwing the null pointer exception. s[j] is null,
you're just not checking it correctly.
>Hi, as far as I can conclude. Yes the error doesn't like that line I posted
>above. nextChar might be the reason, but I am calling this method from
>outside the class. So I don't see why? this would happen.
Obviously you don't know what is going on. So please stop frustrating
those who might, and post the stack trace as requested.
Hmm, I'm pretty sure that's just a meaningless quote before the poster's
answer, everyone has some kind of quote (if you don't, your newsreader will
probably comes with something on its own, pretty boring though...).
So you plonked the guy for this? Seems a bit ridiculous to me...
"Michael" <mbia...@shaw.ca> wrote in message
news:%AXbf.435596$1i.163930@pd7tw2no...
If you're using Eclipse, you can easily debug exactly which expression is giving
the exception:
1. Toggle a breakboint on that line.
2. Debug.
3. Evaluate each expression by selecting it en pressing <ctrl><alt>+'i'. You can
try
<s> (should not be null, as s.length did not give an exception.)
<s[j]>
<s[j].nextChar()>
Greetings, Leon.
Something which, someone at this level, probably should *not*.