Java Scanner Input , there are no compilation errors neither successfull input :    


   
The Following code is a simple java program where i am just getting an input of a student details but the program doesnt do anything it just stays like this no compilation error or does not take any input



    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();

	}

    }
