I want to print values from 1 to 20000 and the output should be printed one above another ie output should be overwritten and final output is 20000 only on the output screen. please help me how it can be done..
Edited by: 882150 on Nov 21, 2011 11:44 PM
Google for jcurses or java curses library. Note, however, that it is not possible to make it work in all cases. Some terminal windows will not accept cursor movement control sequences, or may have their own that are different from the common ones. Your other option would be to make it a Swing app and do it in a GUI.
A JLabel would work well for that. Call its setText() method repeatedly with string versions of each number from 1 to 20000.
Although I have to agree with the implied view that this is a strange thing to do. And a strange thing to require, too. Why would anybody need that done? Just display 20000 and say you're finished.