You are using in.nextLine unnecessarily, and taking more input than given. This causes “No such element” exception.
Even on removing in.nextLine the same error occurs
No, it successfully compiled in my case. It means there are more errors in your code.
Can you give a little summary of your code or may be a pseudo code will help!! You can check out my solution if you like
when u use more inputs than given then this error occurs for exaple in my case i was declaring the scanner class every time i needed an input so when i removed that line the error was gone.