Q:

nextLine ignoring input, but next() don't - why have i clear scanner?

I had problem where nextLine was ignoring user input. After some research, I found that I have to clear the Scanner using in.nextLine(), but can you tell me why? I would like to know what I'm doing when I use this:
String edit = in.nextLine();

switch (edit) {
    case "name":
        System.out.println("Enter new name for " + items.get((editItem - 1)).getName());
        String newName = in.nextLine();
        items.get((editItem - 1)).setName(newName);

A:

Please visit the below links for better understanding why nextline() does not read input :
Scanner is skipping nextLine() after using next() or nextFoo()?
https://www.quora.com/Why-so-when-I-used-to-take-string-input-through-nextLine-method-of-scanner-class-in-Java-it-does-not-read-my-input

