-2

I have a LinkedList class in Java, and I need to add to head and add to tail methods with head reference. Everything works fine with integers, but when I try to add String with nextLine() from the Scanner, it adds space as first input. Everything works fine if I input String with next(). Is there some big difference between next and nextLine methods except basic one?

demongolem
  • 8,796
  • 36
  • 82
  • 101

1 Answers1

0

next() is for reading one word, nextLine() reads whole line.

skyCode
  • 134
  • 2