title: Java - IF statement treats value as NULL even though it isn't when checking in debug
body: <p>This is a strange one so any help would be appreciated.</p>
  <p>I'm working on a Spring Batch job that sends transactions to a Kafka topic and when successful the status code is returned as a String: &quot;C&quot;. There's a check for if this status code is null and if so it will give an appropriate error message as below to be outputted onto a table later on.</p>
  <pre><code>            if (kafkaWriter.getKafkaStatusCode() == null)
              {
                  messagingResultCode = CommonConstants.KAFKA_NULL_RESULT;
              }
  </code></pre>
  <p>So what's happening is that for several transactions that are picked up by the job I get a Kafka null result error message because of the above code so I went into debug to see what was happening putting a breakpoint at where messagingResultCode is set.</p>
  <p>But when I evaluated &quot;kafkaWriter.getKafkaStatusCode() == null&quot; it showed as &quot;(boolean) false&quot; in Spring Tools Suite. When looking at the KafkaStatusCode it shows as &quot;C&quot; so definitely not null, but it still went into the code anyway.</p>
  <p>All getKafkaStatusCode() does is return a String:</p>
  <pre><code>public String getKafkaStatusCode() {
      return kafkaStatusCode;
  }
  </code></pre>
  <p>This only ever happens on the first job that's been run on the server (I'm using Liberty) and on all subsequent runs the code behaves as expected.</p>
  <p>I've tried initialising the String messagingResultCode to null, &quot;&quot; and a default value but the same thing happens every time.</p>
  <p>Thanks</p>