Good day everyone, I have a question. I am constructing a timer in Java console, wherein this timer should be located in one corner (such as upper right). I can only make it count up on its own place. My question is how can I place the code on the upper right corner?
import java.awt.*;
import java.io.*;
import java.util.*;
public class timerForJobs
{
public static void main(String args[])
{
Scanner keyboard = new Scanner(System.in);
int duration = 0;
try
{
System.out.print("Input duration in seconds: ");
duration = keyboard.nextInt();
Thread.sleep(1000);
for(int i = 0; i <= duration; i++)
{
System.out.print(i + "\r");
Thread.sleep(1000);
}
System.out.println("Job terminated.");
}
catch(InterruptedException e) { }
}
}