Answered: use .equals(), I'm going to leave this up for others looking for why == equals to doesn't work with strings. Look at this post for more info How do I compare strings in Java?
The while loop I'm using compares a string read from a file to what I type in and is always considered not equal too. I created a program that reads a file line by line between 2 delimiters. It is supposed to stop reading when it reads a delimiter.
String s;
s=inputFile.nextLine(); (after reading the file s="SOMETEXTHERE")
while (s!="/**/")
{
do stuff with s...
s=inputFile.nextLine(); (after multiple lines s will read "/**/")
}
As long as s is not equal to the delimiter it will keep going, once it reads the delimiter it should stop. It doesn't stop. The String of "/**/" == "/**/" evaluates as false, I've tried debugging and it clearly says 2 equal strings are not equal.
My .txt file that is is reading looks similar to below
SOMETEXTHERE
SOMETEXTHERE
SOMETEXTHERE
/**/