I am surprised to see this behaviour.
Is it a bug or something?
for(Object obj = new Object(), Integer = new Integer(300);
obj.toString().length()>3;
System.out.println("on object's loop")) {
} //causes an infinite loop (not foreach loop, of course)
above code compiles and run fine without any reference to new Integer(300)
. Why so?
I am only interested in knowing why Integer = new Integer(300);
is okay without any reference.