Slow Print(In java)
EpicGamer007 (1238)

I noticed a lot of the repls in are in python and a lot of the console programs are in python(because it is the most popular). A lot of them use slow print. So this tutorial teaches you how to slow print(print 1 char, wait, then write another char) in java.

My Code:

public class Main{

  public static void main(String[] args){

  public void slowPrint(int time, String toPrint){
    char[] toPrintC = toPrint.toCharArray();// Create a char array and assign that to a string converted to a char array

    for(int i = 0; i < toPrintC.length;i++){ // Create a for loop
      System.out.print(toPrintC[i]);// Print the char
        Thread.sleep(time);// Stop printing for the amount of milliseconds specified(in the variable time)
      }catch(Exception e){
      // We surround in try/catch because Thread.sleep throws an exception



Hope this helps!

You are viewing a single comment. View All
EpicGamer007 (1238)

@Highwayman, Though about the Exception, you can dodge it by having EACH METHOD THAT USES IT throws InterruptedException but then you would have to do that for EVERY METHOD THAT USES IT(As I just said) so I do not recommend doing that