I wanted to show progress bar in console by replacing old character by new character so that only one character will be shown at any given time. Example:
char[] progressBarChars = { '/', '-', '\\', '-' };
for(int i=0; i<progressBarChars.length; i++) {
System.err.print("\r"+progressBarChars[i]);//it is not replacing previous character in console. i don't want to see previous char in console
}
Output: i should be able to see characters are getting replaced in a single line/place in console.