public class ForTest{
public static void main(String[] args)
{
String s;
for(s="ha"; s!="haha"; s=s+"ha"){
System.out.println(s);
}
}
}
In my opinion, this code should work which just print "ha", Because after one loop, s="ha" would become s="haha" and then it will stop the loop. However, it doesn't stop and shows infinite looping.
Could you help me to know what is the reason of it?