I have this small problem with my input :
public void input()
{
Scanner scn = new Scanner( System.in );
System.out.print( "Please enter id: " );
id = scn.nextInt();
System.out.print( "Please enter name: " );
title = scn.nextLine();
System.out.print( "Please enter author: " );
author = scn.nextLine();
}
Now I'm using scn.nextLine()
because I want to have spaces when giving the name and the author like :
USER INPUT:
Story of Something
Sir Whatever
The problem is when I use nextLine()
the program doesn't wait for my input, it just continues and my console will look like this:
Please enter id: 4632
Please enter name: Please enter author: what, why??
Any way to fix this, please help?