So, basically what I want to do is have a percentage. So it goes up 0%, 1% and so on but, instead of having it all printed, I want the %1 percent replaced with 2%. So I know how to do the basic for
loop but I don't know how to use \r
or \b
because in my compiler all I'm getting is it printing it all in one line.
package test;
public class est
{
public static void main(String[] args)
{
for(int i = 0; i <= 100; i++ )
{
System.out.print("\rPercent = " + i + "%");
}
}
}
output:
Percent = 0%
Percent = 1%
...
Percent = 99%
Percent = 100%
So it prints 100 lines; but I only want that information on one line.