
Question:
I'm trying to write an educational, simple, calculator with no GUI. But I can't seem to know how to get the operation symbol from the user .. I need to get the Char provided by the user .. I'm new to Java, and I searched a lot .. but I couldn't find out how ..
Answer1:Can you post some of the code you've got so far? I'm thinking you can use the Scanner class to grab the char entered by the user. I personally haven't used StdIn.readChar() before as fredley has suggested, but I'm quite new to Java too.
EDIT: Oops, I didn't read the question title:
This could work:
scanner.nextLine().charAt(0);
Answer2:The scanner class in Java has no method defined to read character entered by user so you have to get the input in form of a string and then change it to a character by some suitable technique.