Click here to Skip to main content
15,905,915 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need a substitute java code / function for getch() of C. (for console application)
Can Any One Help?? :)
for ex: getch is used for input a char .. it does not wait for ENTER.. need a function which does not wait for "enter".. and it takes one char as input...(in java) with example
Posted
Updated 24-Mar-12 6:35am
v3
Comments
[no name] 23-Mar-12 13:05pm    
What? You are writing a Windows console app and you need the Java equivalent of the C function getch() ????

1 solution

try
Java
String val = console.readLine()


or

C#
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String val= in.readLine();
 
Share this answer
 
Comments
sonigaurav1 24-Mar-12 2:58am    
CAn u give me an example of it???? If yes pls
sonigaurav1 24-Mar-12 11:09am    
getch is used for input a char .. it does not wait for ENTER.. nw got my mean..??need a function which does not wait for "enter".. and it takes one char as input...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900