It's not a secret anymore!
The moose likes Beginning Java and the fly likes If statement to continue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "If statement to continue" Watch "If statement to continue" New topic

If statement to continue

Melisa Mitchell

Joined: Sep 15, 2008
Posts: 12
Hello Everyone,

I have this code...

the stuff that is in bold is what i have added to it, what i have to do is say if thislevel is equal to null then continue, but its not working!?!?! what am i doing wrong anyone?


[ September 25, 2008: Message edited by: Melisa Mitchell ]
[ September 25, 2008: Message edited by: Melisa Mitchell ]

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33129

I think you mean the opposite - to only do the if statement if thisLevel is not null. (If it were null and the if statement executed, you'd get a null pointer calling getEnabled.)

When thisLevel is null, the if statement doesn't execute which means the next statement is the next iteration of the loop.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: If statement to continue
It's not a secret anymore!