Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Interview-Questions getch() method in java

Have Programming Question? Ask it here!
 
 
 


saba s
getch() method in java
1 Answer(s)      3 years and 8 months ago
Posted in : Java Interview Questions


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


Advertisement
View Answers

November 20, 2010 at 1:14 PM


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



Related Tutorials/Questions & Answers:
 

 

 

DMCA.com