I have this code:
while (length < content.length()) {
        tok += chars.get(length);
        tok = tok.toLowerCase();
        if (chars.get(length) == ' ') tok = "";
        else if (tok == "print") System.out.println("FOUND PRINT!");
        System.out.println(tok);
        length++;
    }
What I'm trying to do is to create a programming language with this. But when I try to detect if (tok == "print") it doesn't detect it. I used an ArrayList to store all chars from a string to that array, and then use a while loop to loop the string's length which you can see in the code. Then I add every char from the array list to the string and when I try detecting if the string is something it won't work.
Output of this code:
[P, R, I, N, T,  , ", H, E, L, L, O, "]
p 
pr 
pri 
prin
print - I'm trying to detect this
"
"h
"he
"hel
"hell
"hello
"hello"
 
    