DNA Sequencing conditional question (Why do we use not equal to -1?)

Project – Step 9 - https://www.codecademy.com/courses/learn-java/projects/java-dna-sequencing
Greetings! Trying to sit here in my sick haze, I was a bit perplexed by this following condition:

" Lastly, you’ll find out whether or not there is a protein!

Let’s start with an if statement that checks for a start codon and a stop codon using the && operator.

Remember that the indexOf() string method will return -1 if the substring doesn’t exist within a String."

To which I quickly selected the: “Hint” feature and found that they structured it as:

if (start != -1 && stop != -1) {    System.out.println("Condition 1 and 2 are satisfied.");  } 

Is this because they are trying to ensure that they do not return a “-1 if the substring doesn’t exist within a String” error? They way I would structure it off the top of my head is:

//
if (start == ‘ATG’ && stop == ‘TGA’) {
System.out.println(“Condition 1 and 2 are satisfied”);
//

Is this not correct? Or are they ensuring validity in some other way? I am a biologist, so this is new to me. I apologize!

Howdy!

I don’t have access to that content so please bear with me if I’m misunderstanding :sweat_smile:
What is assigned to start and stop? If it is the result of calling indexOf() I would guess it to be an integer yes?
So if you were using strings in the comparison, the condition would always be false right?