I hope there is at least one nice person who would like to help me - this topic is going to frustrate me a lot.
I have an issue to read data from console in specific composition, which means: in first row I have three signs separeted by space - 2 digits and 1 character. In second row there is line of String. Example:
1 2 E
WHUNDDLOOD
5 7 S
LRRMSDDD
I need to have them as type of byte (first two digits), character (last sign in first row) and a string (whole second line).
I tried to use Scanner, but it's not possible to read char from it. However I tried to use "charAt()" but... probably I'm tired about it.
Excerpt of my code:
while (stdin.hasNextLine()) {
Scanner stdin = new Scanner(System.in);
byte x = stdin.nextByte();
byte y = stdin.nextByte();
char h = stdin.next().charAt(0);
String str = stdin.nextLine();
}
I got the InputMismatchException and last string is not even read. Can you help me?