+ 1
How to display text once in a loop in Java ?
In Java, how to display text once in a loop ? Example, in a countdown I want to display once the text "you have 10 seconds left." when the count arrives at 10. Is there any other solution apart from this one ? If (i==10) { System.out.println() ; } Another example Suppose that a program calculates the fall of an object and displays its speed from second to second. As soon as the object speed exceeds a given speed (10 m / s), the program displays (in addition, but only once) a message. The speed displayed is not always equal to 10m/s. Thanks for your help.
7 Respuestas
+ 3
~ swim ~ it's like codemonkey says. Thank you all.
+ 2
Thanks you. It's work.
0
it was not the answer I wanted. I misspoke my question. Please review my other example. Thank you.
0
System.out.println("You have " + i + "seconds left");