+ 1
Can someone explain why this doesn't work?
2 Answers
+ 12
Fixed.
1. Use charAt(0) instead of charAt(1)
2. While taking string input after int/double, the ENTER pressed after the int input is considered as the string input. So it doesn't wait for the next input. That's why you must put an extra input.nextLine() to consume the ENTER.
More details: https://stackoverflow.com/questions/26626106/why-string-inputs-after-integer-input-gets-skipped-in-java
https://code.sololearn.com/cvJ42140AvMO/?ref=app
+ 1
Thanks @Shamima Yasmin