The below code is part of a program. When the string s is passed as "one one" then in the first iteration, the value of the variable word is getting set to one but still, program is not getting inside the if statement. Please help.
for (String word : s.split(" ")) {
if (word == "one") {
if (d == 2) {
r = s.concat("11");
d = 0;
}
else if (t == 3) {
r = s.concat("111");
t = 0;
}
else {
r = s.concat("1");
}
}
}