class time{ public static void main(String args[]) { for(int h=0;h<=24;h++) { for(int m=0;m<=60;m++) { for(int s=0;s<=60;s++) { try { Thread.sleep(1000); }catch (InterruptedException ie) { System.out.println(ie.getMessage()); } System.out.println(h+":"+m+":"+s); } } } } }
The program is correct but i want the screen to be cleared after every time it displays... i searched a lot for a statement which would clear the screen but i dint find any relevant result... i use command prompt for compiling and running java programs...
The second program is
it compiles well but while running the class file the compiler issues the following warning
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 6 at Sorting.main(Sorting.java:6)