I am trying to use apache commons to read a dictionary. When I use this code
for(String line: FileUtils.readLines(new File("dictionary.txt")))
System.out.println(line);
}
it prints the whole file. But when i use this code nothing happens when i am 100% sure b and line are the same
for(String line: FileUtils.readLines(new File("dictionary.txt")))
{
if(line.toLowerCase() == b.toLowerCase())
{
valid = true;
System.out.println(line);
}
So whats wrong?