0

I'm trying to run code based off of a cell being pulled in from my excel sheet. My code runs but then it stops at the if statement. If statement below.

if(data03 == "Checkpoint")

java

  • use `.equals` to compare strings not `==` – YCF_L Jul 05 '18 at 17:46
  • try `if(data03.equals("Checkpoint"));` – anoopknr Jul 05 '18 at 17:47
  • Do you know how debugging Java code works? If not, try to learn that because it will give you more information which you can place in your questions (for example "`data03` has the value 'Checkpoint' but the if body still is not executed"). – Marcus K. Jul 05 '18 at 17:53

1 Answers1

1

Try :-

if ("Checkpoint".equals(data03)) { }

For String comparisons .equals() function is used in java. Not ==. The == just compares object references. .equals() tests for equality.

For more Information.

anoopknr
  • 2,786
  • 2
  • 19
  • 29