title: Issues with nextLine();
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/7056749/scanner-issue-when-using-nextline-after-nextint">Scanner issue when using nextLine after nextInt</a>  </p>
  </blockquote>
  
  
  
  <p>I am trying create a program where it lets the user inputs values into an array using scanner. </p>
  
  <p>However, when the program asks for the student's next of kin, it doesn't let the user to input anything and straight away ends the program. </p>
  
  <p>Below is the code that I have done:</p>
  
  <pre><code>if(index!=-1)
      {
          Function.print("Enter full name: ");
          stdName = input.nextLine();
  
          Function.print("Enter student no.: ");
          stdNo = input.nextLine();
  
          Function.print("Enter age: ");
          stdAge = input.nextInt();
  
          Function.print("Enter next of kin: ");
          stdKin = input.nextLine();
  
          Student newStd = new Student(stdName, stdNo, stdAge, stdKin);
          stdDetails[index] = newStd;
      }
  </code></pre>
  
  <p>I have tried using next(); but it will only just take the first word of the user input which is not what I wanted. Is there anyway to solve this problem?</p>