the following is my sources code:
package functiontest;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOExce
Your problem is that the line
option = scan.nextInt();
does not read the new line character after the integer. So that new line is finally read when you do nextLine()
, later on.
To fix this, you should add an extra
scan.nextLine()
after the call to nextInt()
, then use
cname = scan.nextLine();
when you want to read the clerk's name.