This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
**************************************************************************** import java.io.IOException; public class Stp { public static void main(String args[]) throws IOException{ System.out.println("++++++++++++++++++++++++++"); System.out.println("+ TIMER +"); System.out.println("++++++++++++++++++++++++++"); System.out.print("+ "); for(int m=0;m<1;m++){ for(int s=0;s<60;s++){ for(int ms=0;ms<10;ms++){ try{ System.out.printf("%d:%d:%d\b\b\b\b\b\b\b",m,s,ms); Thread.sleep(100L); }catch(Exception e){ System.out.println("error"); } } } } } } *************************************************************************** when i run the above code it is not displaying the printf till program running ends
If e.g. "System.out.println("m="+ m + ", s=" + s + ", ms=" + ms);" is used under System.out.printf then it is always printed to output. Seems like an issue with java Formatter
The problem is that the output window is not a console, the System.out is a PrintStream (buffered) with autoFlush==true so it's flushed by: The output is flushed either by: 1) By call of println 2) By '\n' char 3) byte[] The 3) causes that it works fine on console but it's not flushed in output window, it requires '\n' or close.
When i tried the code it worked for first time later its not printing .
Thank u Martin Balin that worked but i want to clear the console at each iteration of loop
(In reply to Tomas Zezula from comment #2) > The problem is that the output window is not a console, the System.out is a > PrintStream (buffered) with autoFlush==true so it's flushed by: > > The output is flushed either by: > 1) By call of println > 2) By '\n' char > 3) byte[] > > The 3) causes that it works fine on console but it's not flushed in output > window, it requires '\n' or close. Thank u Tomas Zezula \n worked but my requirement is \b . \n worked perfectly with printf \b is not working Please suggest me something to fix this \b not working issue