I have to read a String from a field and then convert it to a Boolean.
I've tried this:
ObjectInputStream nm;
nm = new ObjectInputStream(new FileInputStream("buscamines.txt"));
String s = nm.readLine();
Boolean bool = Boolean.valueOf(s);
But it's not working, when I print the string s, it is correct but the Boolean value is always false.
Is there any other way to convert a String to Boolean?
scontains leading (or trailing) spaces? Perhaps it contains non-printing characters? I presume that the value ofsis true. I suggest you print the length ofsand see whether it is 4.