I want to make a program in Java that generates different prints, but at the same time has a time counter on the first line of the CMD that keeps updating even when I printing more elements.
For example:
******* CMD ********
timer: 2 hours, 37 minutes and 37 seconds
First print
Second print
...
********************
I know how to do the counter, I just want to make it stay in the same place at the exit of the CMD while the program runs.
I tried to use \r, but always when I use \n the output ends up unconfiguring.
To be more generic, I want to know how to separate CMD with Java into "blocks", so that each block has its own output.
// Another example
class Main {
  public static void main(String[] args) {
    // block 1
    System.out.println("A");
    
    // block 2
    System.out.println("B");
    //block 1 again
    System.out.println("C");
  }
}
/*
    Output I want in CMD:
    A
    C
    B
*/
 
    