-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
  • 9,474
  • 36
  • 90
  • 105

1 Answers1

0

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

skyCode
  • 358
  • 1
  • 7