I have the following lines :
for (int i=0;i<3;i++) System.out.print("\nA : "+i);
// System.out.println("");
// for (int i=0;i<3;i++) System.out.println("B : "+i);
The output is :
A : 0
A : 1
A : 2A : 2
Why ? I expected this :
A : 0
A : 1
A : 2
But if I uncomment the 2nd and 3rd lines [ together or one at a time ], it behaved correctly ? What's going on ? Is it my PC problem, or my NB6.7 problem ? I can't believe Java would do this !
Edit :
for (int i=0;i<3;i++) System.out.print("A: "+i+"\n")
works correctly as expected.
When I ran it from command line, no problem at all, seems like a NB problem.