title: scan.nextLine does not work
body: <p>I used Java and I tried to write program that reads a number of patients and then let the employee enter their names and ages.</p>
  
  <p>and I want the program reads full name such as (Maha Saeed) so I wrote the code like this but I don't know why it does not work </p>
  
  <pre><code>name = scan.nextLine();
  </code></pre>
  
  <p>and this is the full code</p>
  
  <pre><code>import java.util.*;
  
  public class Answer1
  {
  static Scanner scan = new Scanner (System.in);
  public static void main (String[] args)
  {
  
  int age ; 
  int PatientNumber ;
  int PatientNO;
  String name ;
  
  
  System.out.print("Enter number of patients :");
  
  PatientNumber =  scan.nextInt();
  PatientNO = 1;
  
  while ( PatientNO &lt;= PatientNumber)
  {
  System.out.println("Patient #" +PatientNO);
  System.out.print("Enter patient's Name: ");
  name = scan.nextLine(); //&lt;- here is the problem if I write scan.next it works but it reads only the first name
  
  System.out.print("Enter patient's Age: ");
  age= scan.nextInt();
  PatientNO = PatientNO + 1;
  }
  
  }
  }
  </code></pre>
  
  <p>thanks all</p>