This time, we learn how we can make program so that there are delay between execution of program.

We can using sleep() method. We can passing value in milisecond (remember that 1 second equal to 1000 milisecond).
The sleep method can throws an InterruptedException. Then we must have write sleep() method within try-catch block.

public class DelayExample{
	public static void main(String[] args){
		System.out.println("Hi");
		try{
			Thread.sleep(2000);
		}catch (InterruptedException e){
			e.printStackTrace();
		}
		System.out.println("my name is Bayu");
	}
}

Easy huh?:mrgreen: