private String getWhoozitYs(){
StringBuffer sb = new StringBuffer();
boolean stop = generator.nextBoolean();
if(stop = true)
{
sb.append(\"y\
Actually, the entire approach would be cleaner if you only had to use one instance of StringBuffer, instead of creating one in every recursive call... I would go for:
private String getWhoozitYs(){
StringBuffer sb = new StringBuffer();
while (generator.nextBoolean()) {
sb.append("y");
}
return sb.toString();
}
if(stop == true)
or
if(stop)
= is for assignment.
== is for checking condition.
if(stop = true)
It will assign true to stop and evaluates if(true). So it will always execute the code inside if because stop will always being assigned with true.