Java tutorial
import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static void main(String[] args) { Test g = new Test(); System.out.println("The time is now: " + g.currentTime()); System.out.println("The time is now: " + g.currentTime()); System.out.println("The time is now: " + g.currentTime()); System.out.println("The time is now: " + g.currentTime()); } } class Test { private int minutesToAdd = 0; private Calendar cal = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); public String currentTime() { cal.add(Calendar.MINUTE, minutesToAdd++); return sdf.format(cal.getTime()); } }