+ 2
Does the while loop print \n automatic after any one of the loops ? What should we do to not print that \n ?
2 ответов
+ 3
System.out.print(prints & stays on the same line);
System.out.println(prints & moves to next line);
if theres a print statement inside of the loop body it will be executed each loop
if theres a print statement outside of the loop body it will be executed once the loop finishes.
for(){this is the body of the for loop}
+ 12
no , u will not get \n after each cycle of loop
/* for getting next line after every loop ... u can do*/
while(condition){
//statement(s);
System.out.println (""); //last statement of loop
}