nextLine() reads leftover newline. Frame the concept in practical terms so you can explain it during interview discussion.
After using 'nextInt()', a newline character remains in the input buffer, which 'nextLine()' then reads, causing unintended behavior. To avoid this, call 'nextLine()' immediately after 'nextInt()' to clear the buffer. This is important when taking multiple inputs in sequence, like reading a quantity and then a product name.
Additional Notes
Common pitfall with Scanner’s nextInt() followed by nextLine()?