By GokiSoft.com|
21:27 22/06/2022|
Java Basic
[Video] Java Basic- Nhập xuất java - Scanner trong java - C2108L
Java Basic- Nhập xuất java - Scanner trong java
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package bt975;
import java.util.Scanner;
/**
*
* @author DiepTV
*/
public class Main {
public static void main(String[] args) {
//B1) Khai bao bien
String fullname, address, email, phoneNumber;
int age;
//B2) Khai bao bo nhap du lieu
Scanner input = new Scanner(System.in);
//B3) Nhap du lieu
System.out.println("Nhap ten: ");
fullname = input.nextLine();
System.out.println("Nhap dia chi: ");
address = input.nextLine();
System.out.println("Nhap email: ");
email = input.nextLine();
System.out.println("Nhap SDT: ");
phoneNumber = input.nextLine();
System.out.println("Nhap tuoi: ");
age = Integer.parseInt(input.nextLine());
//B4) Hien thi
System.out.println("Ten: " + fullname + ", dia chi: " + address + ", email: " + email + ", SDT: " + phoneNumber + ", tuoi: " + age);
System.out.format("\nTen: %s, tuoi: %d, dia chi: %s, email: %s, so dien thoai: %s", fullname, age, address, email, phoneNumber);
}
}
Tags:
Phản hồi từ học viên
5
(Dựa trên đánh giá ngày hôm nay)