title: Java Scanner Input , there are no compilation errors neither successful input
body: <p>The Following code is a simple java program where I am just getting an input of a student details but the program doesn't do anything it just stays like this no compilation error or does not take any input</p>
  
  <pre><code>import java.util.Scanner;
  
  public class Scannerexample {
  
  public static void main(String[] args) {
  
  Scanner scan = new Scanner(System.in);
  int Rollno = scan.nextInt();
  String firstname = scan.nextLine();
  String lastname = scan.nextLine();
  String Department = scan.nextLine();
  Boolean Result = scan.hasNext();
  char gender = scan.next().charAt(0);
  
  System.out.println("Enter Rollno "+ Rollno);
  System.out.println("Enter Firstname "+ firstname);
  System.out.println("Enter Lastname "+ lastname);
  System.out.println("Enter Department "+ Department);
  System.out.println("Enter Result "+ Result);
  System.out.println("Enter Gender "+ gender);
  
  scan.close();
  
  }
  
  }
  </code></pre>