I am trying to make a program that updates currentTime every second so that in the console it will go 1s, 2s, 3s, 4s and so on.
public static void main(String[] args) throws InterruptedException{
OSpanel runner = new OSpanel();
runner.currentTime();
}
public static void currentTime() throws InterruptedException{
if(true) {
Date currentTime = new Date();
while(true) {
Thread.sleep(1000);
System.out.println(currentTime);
Thread.sleep(1000);
System.out.println(currentTime);
}
}
}