Write a Java program to input a string and print each character from that separately on screen with a delay of 100 ms after each character.
import java.util.Scanner;
public class PrintCharWithDelay {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.print("Enter the string :: ");
String str = s.nextLine();
for(int i=0; i<str.length(); i++) {
System.out.println(str.charAt(i));
try {
Thread.sleep(100);
}
catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
Enter the string :: Rahul
R
a
h
u
l