Skip to content

Instantly share code, notes, and snippets.

@aperture147
Created December 18, 2017 10:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aperture147/46afa6c15e574045c60b59dec7fb4dca to your computer and use it in GitHub Desktop.
Save aperture147/46afa6c15e574045c60b59dec7fb4dca to your computer and use it in GitHub Desktop.
Scanner Example
import java.util.Scanner;
public class MainApp {
public static void main(String[] args) {
String ten;
int tuoi = 0;
String diachi;
Scanner input = new Scanner(System.in);
System.out.print("Nhap ten: ");
ten = input.nextLine();
System.out.print("Nhap tuoi: ");
tuoi = input.nextInt();
System.out.print("Nhap dia chi: ");
diachi = input.nextLine(); //dòng lệnh ở đây có vẻ không hoạt động
System.out.printf("Ten: %s, tuoi: %d, dia chi: %s", ten, tuoi, diachi);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment