[Java] Drifting in order to use Java Scanner

When using the scanner to enter data in Java are likely to be passed command. For example, as you simply enter the number first and then enter the string, Meanwhile characters “n” (enter) when you enter the number of buffers that have not been retrieved, results when executing the next entry it takes character strings “n” do you not get into. To resolve this problem do the following:

int age = Integer.parseInt(scan.nextLine());   // tranh troi lenh nhu khi dung age = scan.nextInt()
String name = scan.nextLine();

That is, we just enter the string as normal and then convert the int