F
F
freshcot2015-01-26 20:36:22
Java
freshcot, 2015-01-26 20:36:22

What is the error in checking the value?

Hello. How is it that the break command is not executed?
This is when debugging a specific line
a5fc4e86d12446f8a50d73df41b509bf.png
And this is the next step of the cycle 188405bac0544f469c1f5198e0742839.png
It is not quite visible on the screenshot, break comes after the if

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vit, 2015-01-26
@freshcot

I haven't written in java for a long time, but something tells me that strings cannot be compared through the == operation. It is necessary through the equals method. The thing is that the strings can be the same, but they are represented by different objects in memory. The == operator will return false if the objects are different, even if they have the same content.

Y
yanchumak, 2015-01-26
@yanchumak

strings are compared using equals

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question