Is there any way of processing only single charater in java using a simple program?
I should ask user to enter a charater, when user enters a character my java program should process it before user enters the next character, and should give an immediate response to user on the character that he has entered.I tried this
public class InputChar {
public static void main(String args[]) {
System.out.printf("Enter Char ==> ");
try {
char temp = (char) System.in.read();
System.out.printf("You Entered: " + temp + "\n");
} catch (Exception exe) {
exe.printStackTrace();
}
}
}
but still in above program whenever user enters a character it is not printing the character right away.In the above program when user presses 'Enter' key then only the program processes whatever he has entered.Is there anyway to do without pressing 'Enter' key to process the only first charater input that user has entered.