/**
* Print 1-50 numbers in desc order. (Number should print in 1 second interval).
*
*
*/
public class CountDown {
/**
* display the 1-50 nos in descending order with delay of 1sec
*/
public static void displayNoWithDelay() {
try {
System.out.println("Printing Numbers In Descendign Order :");
for (int i = 50; i >= 1; i--) {
// print no
System.out.println(i);
// make the delay
Thread.sleep(1000);
}
System.out.println("Numbers Printed!!");
} catch (Exception e) {
System.out.println("Error Occured!!");
e.printStackTrace();
}
}
/**
* execution begin from here
*
* @param args
* commandline arguments
*/
public static void main(String[] args) {
displayNoWithDelay();
}
}
No comments:
Post a Comment