import java.util.Timer; import java.util.TimerTask; public class SlowTextRepeatingTask { public static void main(String[] args) { ShowSlowText("This text should be printed slowly, character by character."); } public static void ShowSlowText(String text) { final Timer timer = new Timer(); final String phrase = text; TimerTask slowText = new TimerTask() { int spot = 0; public void run() { char character = phrase.charAt(spot++); System.out.print(character); if (spot >= phrase.length()) timer.cancel(); } }; timer.scheduleAtFixedRate(slowText, 0, 200); } }