Exception in thread “main” java.util.NoSuchElementException
at java.util.Scanner.throwFor(Scanner.java:862)
at java.util.Scanner.next(Scanner.java:1485)
at java.util.Scanner.nextInt(Scanner.java:2117)
at java.util.Scanner.nextInt(Scanner.java:2076)
at Main.main(Main.java:11)
you can check your code on local compiler if it works fine submit it.
also this error/exception comes when there is no input to the scanner
you can use this before scanning data
if(s.hasNextInt())
hope it works
Did you just “Run” the code without giving input in custom input?
1 Like
I think so
it also has troubled me