Equivalent function to C's “_getch()” in Java?

前端 未结 7 1802
情话喂你
情话喂你 2020-11-27 07:51

I use Google Wave, and I want to emulate the ability to send messages before you actually hit the enter key.

Is there a Java equivalent to the C function _getc

7条回答
  •  醉梦人生
    2020-11-27 08:14

    This will Do the trick but i works only from command line . Not from IDE

     Console c =System.console();
    Reader r = c.reader();
    try {
        num=    r.read();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    

提交回复
热议问题