I need to get the ASCII value of each character entered. I have char and whitespace but can not seem to get a value for "next line" / enter.
I thought to use an if statement saying that if(letter == '\n') (ascii = 10) but it 1. does not work and 2. it is forcing the value manually and I am trying to figure out how to get it read and assigned automatically.
Scanner scan = new Scanner(System.in);
char letter = scan.nextLine().charAt(0);
int ascii = (int) letter;
System.out.println(ascii);
scan.close();
Scanner.nextLine()
removes the line terminator, as doesBufferedReader.readLine()
. You will never see it.WorkItem
question? stackoverflow.com/questions/56640516/…