
does someone know how can i obtain the getch() function in java?

Hi Friend,
In java, you can use the method next() of Scanner class.
Here is an example:
import java.util.*;
class Hello{
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
System.out.println("Enter: ");
String st=input.next();
System.out.println("You have entered: "+st);
}
}
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.