In Java, you have to use equals() for string equality; otherwise it does a reference comparison.
In Java, you have to use .equals() for string equality; otherwise it does a reference comparison. String s1 = "end"; String s2 = "end"; // different string in memory s1 == s2 // false: not the same string s1. Equals(s2) // true: have the same characters "end".
Equals(s1) // also true "end" == s1 // false And yeah, it sucks.
He has (!(file. Equals("end"))) in his code – Anthony Forloney Jan 28 '10 at 23:10 1 Actually, all String literals are interned, so in this case s1 == s2 will return true. – danben Jan 28 '10 at 23:14 Ah this is the problem.
I had tried the . Equals but used it wrongly! Thank you.
– Graeme Jan 28 '10 at 23:15 In your example, s1 might (and probably will) be equal to s2, as danben said. A better example would be: String s1 = new String("end"); String s2 = new String("end"); – Eli Acherkan Jan 28 '10 at 7:04.
I think your problem is here: if(file! =file2) { file= "bin/" + file + ". Txt"; Unless you enter "end" twice, you overwrite file before the next check.
Also, I think you want if(!file. Equals(file2)) { file= "bin/" + file + ". Txt"; Edit: in response to your comment, just changing from == "end" to .
Equals("end") should do it.
Sorry, I gave you the wrong code. The code I actually am working with is above. That line should just be file!
="end". Same with the while statement. – Graeme Jan 28 '10 at 23:14 Even at that, you should have if (!file.
Equals("end")) – Anthony Forloney Jan 28 '10 at 23:15.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.