Is there a way to delete a character written by console with System.out
or System.err
?
For example, if I have a process that loads for a while, simulate an animation with the 3 ellipsis ...
. Something similar to this demo on fiddle .
int puntos = 0;
final String PUNTO = ".";
System.out.print("Conectando, espera");
while (condicionQueSeCumplaAlAcabarElProceso) {
if (puntos < 3) { // comprobar cuantos puntos hay
System.out.print(PUNTO); // poner un punto
puntos ++; // indicarlo
try {
Thread.sleep(1000); // esperar 1 segundo
} catch(InterruptedException ex) {
Thread.currentThread().interrupt();
}
} else {
// aqui hay que borrar los 3 puntos ¿como se hace?
puntos = 0; // resetear
}
}