
TỔNG HỢP BÀI LAB JAVA - NỘI DUNG
CHI TIẾT
BÀI LAB 1: Hello World
- T o project Java trên NetBeans.ạ
- Vi t class HelloWorld v i hàm main().ế ớ
- In ra chu i "Hello, world!".ỗ
Code:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, world!");
}
}
BÀI LAB 2: Biến và toán tử
- Khai báo bi n (int, double, String).ế
- Toán t s h c: +, -, *, /, %.ử ố ọ
- Toán t logic: &&, ||, !.ử
- Toán t quan h : >, <, ==, !=.ử ệ
Ví d : nh p a,b, in t ng, hi u, tích, th ng.ụ ậ ổ ệ ươ
BÀI LAB 3: Cấu trúc điều kiện
- if, if-else, if-else if.
- switch-case.
Ví d : nh p đi m, x p lo i gi i/khá/trung bình.ụ ậ ể ế ạ ỏ
BÀI LAB 4: Vòng lặp
- for, while, do-while.
- In b ng c u ch ng, tính t ng n s , ki m tra s nguyên t .ả ử ươ ổ ố ể ố ố
BÀI LAB 5: Mảng
- Khai báo m ng, nh p d li u.ả ậ ữ ệ
- Tính t ng, trung bình, tìm max/min.ổ
- S p x p tăng d n, gi m d n.ắ ế ầ ả ầ

BÀI LAB 6: Hàm (Method)
- Tách ch ng trình thành các hàm.ươ
- Truy n tham s , tr v k t qu .ề ố ả ề ế ả
- Ví d : hàm tính giai th a, hàm ki m tra s nguyên t .ụ ừ ể ố ố
BÀI LAB 7: OOP Cơ bản
- Khái ni m class, object, thu c tính, ph ng th c.ệ ộ ươ ứ
- Ví d : class Student (id, name, gpa), method display().ụ
- Qu n lý danh sách sinh viên v i ArrayList.ả ớ
BÀI LAB 8: Kế thừa
- S d ng t khóa extends.ử ụ ừ
- Ví d : class Person -> Student, Teacher.ụ
- Ghi đè ph ng th c (override).ươ ứ
BÀI LAB 9: Đóng gói
- Dùng private cho thu c tính.ộ
- Getter/setter đ truy c p d li u.ể ậ ữ ệ
- Constructor đ kh i t o.ể ở ạ
BÀI LAB 10: Đa hình, Abstract, Interface
- Abstract class: Shape (Circle, Rectangle).
- Interface: Movable (Car, Bird).
- Đa hình: cùng method name nh ng x lý khác.ư ử
BÀI LAB 11: Xử lý ngoại lệ
- try-catch-finally.
- throw, throws.
- Custom exception: InvalidGpaException.
- Ví d : Calculator b t l i chia cho 0.ụ ắ ỗ
BÀI LAB 12: File I/O
- Đ c/ghi file văn b n: FileReader, FileWriter.ọ ả
- Đ c/ghi file nh phân: FileInputStream, FileOutputStream.ọ ị
- Object serialization v i ObjectOutputStream.ớ
- Ví d : copy file, ghi log.ụ

BÀI LAB 13: Collection Framework
- List: ArrayList, LinkedList.
- Set: HashSet, TreeSet.
- Map: HashMap, TreeMap.
- Duy t b ng for-each, Iterator, forEach lambda.ệ ằ
- S p x p v i Comparable, Comparator.ắ ế ớ
BÀI LAB 14: CSV/JSON + Stream API
- Đ c/ghi CSV (BufferedReader, FileWriter).ọ
- Đ c/ghi JSON v i Gson.ọ ớ
- Stream API: filter, map, collect, groupingBy, averagingDouble, max/min.
- Ví d : tính GPA trung bình theo ngành.ụ
BÀI LAB 15: Stream nâng cao
- Parallel Stream (song song).
- Collector tùy bi n (median, five-number summary).ế
- collectingAndThen, mapping, teeing.
- Grouping l ng nhau, partitioningBy.ồ
- groupByConcurrent cho parallel.
BÀI LAB 16: Concurrency hiện đại
- CompletableFuture: async, thenApply, thenCombine, allOf, anyOf, timeout, retry.
- Virtual Threads (Java 21): thread-per-task nh , ẹ
ExecutorService.newVirtualThreadPerTaskExecutor().
- Structured Concurrency: StructuredTaskScope (ShutdownOnFailure,
ShutdownOnSuccess).
BÀI LAB 17: JDBC & JPA
- JDBC: Connection, Statement, PreparedStatement, ResultSet.
- CRUD: thêm, s a, xóa, tìm.ử
- JPA/Hibernate: Entity, EntityManager, CRUD, JPQL query.
- Ví d : qu n lý b ng students.ụ ả ả
BÀI LAB 18: Spring Boot REST API + JPA
- Spring Boot project v i Spring Web, Spring Data JPA, MySQL Driver.ớ
- Entity Student, Repository, Service, Controller.
- Endpoints CRUD: GET, POST, PUT, DELETE.
- Test b ng Postman.ằ

BÀI LAB 19: Spring Boot + React Fullstack
- Backend: API CRUD Student (Spring Boot + JPA).
- Frontend React: Axios g i API, React Router, form CRUD.ọ
- Hi n th danh sách, thêm/s a/xóa sinh viên.ể ị ử
- K t n i fullstack ch y song song (8080 & 3000).ế ố ạ
BÀI LAB 20: Spring Boot Security + JWT + React
- Backend: Spring Security + JWT (register, login, me).
- JWT Utils: sinh, xác th c token.ự
- React: form Login/Register, l u token vào localStorage, Axios interceptor.ư
- Profile route ch vào đ c khi có token h p l .ỉ ượ ợ ệ

