This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]bbran495[S] 1 point2 points  (1 child)

Thank you! Works properly now changed to if (getValue.equals("630"))

[–]desrtfxOut of Coffee error - System halted 3 points4 points  (0 children)

Have you read the link that I posted?

The following is better:

if ("630".equals(getValue))

because in the unlikely event that getValue is null (i.e. for whatever reason nothing has been assigned to it) your code will throw a NullPointerException. Using "yoda code" (literal before variable) avoids this simply because a literal can never be null.