Các bài tập java cơ bản
Bài 1: Nhập ký tự từ bàn phím
import java.io.IOException;
import java.lang.*;
public class Main {
public static void main(String[] args) {
char ch = '';
try {
ch = (char) System.in.read();
} catch (IOException e) {
System.out.println("Nhập lỗi!");
}
System.out.println("Ky tu vua nhap:" + ch);
}
}
a
Ky tu vua nhap:a
Bài 2: Nhập số từ bàn phím
import java.io.*;
public class Main {
public static void main(String[] args) {
...
bài tập java cơ bản
bài tập java
1811