There is, say, such a code:
String m = "1101101"; boolean[] check = new boolean[7]; conversion(m, check); for(boolean v : check){ System.out.println(v); } public void conversion(String days, boolean[] checkDays){ for(int i = 0; i < days.toCharArray().length; i++){ char p = days.toCharArray()[i]; System.out.println(p); if(days.toCharArray()[i] == '1'){ checkDays[i] = true; } else { checkDays[i] = false; } } }
sout (p) displays everything correctly: "1101101", and sout (v) always displays "false". I understand that the error in comparison may lie on the surface, but I can not notice.
sout(p)
andsout(v)
? - s8amboolean[] check = new boolean[7];
- each element of thecheck
array isfalse
. I think you and they do not change. - s8am== '1'
and immediately goes toelse
- Ivan