Wednesday 25 June 2014

Program to print delayed output

import javax.swing.*;

public class delayed {

public static void main(String[] args)
{
int i;

for(i=0; i<=5; i++)
{
try
{

Thread.sleep(1000);

}
catch(Exception e){}
System.out.println("i="+i);
}

}}

output:
i=0
i=1
i=2
i=3
i=4
i=5

No comments:

Post a Comment

SAY HELLO!!