scasol
appears to be empty when ScalesFitness
is called. In the RandomBinaryString
method, you never actually construct s
, but rather, just print it out. Instead of System.out.print(s+'0')
and the other line, you should have s += '0';
.
Since this appears to be an exercise, I'll leave the rest to you, but here is a tip for next time: don't have a function do more than it's supposed to (such as printing out its results), otherwise, it might look like the set of functions is actually working, when in reality it isn't.
In this case, it looked like everything was working fine since it appeared like the s.println()
function what actually printing out scasol
, but in reality, scasol
was empty and the RandomBinaryString
method was actually doing the printing.