clrscr and getch in java - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

clrscr and getch in java

zhi_yizhi_yi Posts: 28Member
hi there.

please help me, how to clear screen and getch in java?



  • r035198xr035198x Posts: 5Member
    : hi there.
    : please help me, how to clear screen and getch in java?
    : thanks
    For clearing the screen you have to do something so complicated that i suggest you have nothing to do with it.

    For getch however, java treats the console like a stream lets say like a file.It reads it and writes to it as it would a file. Here is how to do it
    class Console {
    public static void main(String[] arguments ) {

    BufferedReader inputStream = null;
    try {
    inputStream = new BufferedReader(new InputStreamReader(;
    String line = inputStream.readLine();
    System.out.println("The text you entered is " + line ) ;
    catch(IOException s) {

    Now you may or may not know some of constructs in there. You can use them without fully understanding them until you get to understand java's IO and exception handling
Sign In or Register to comment.