.........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

TRY, CATCH, FINALLY TRONG JAVA

Trước khi vào chi tiết, mình sẽ nêu 1 tình huống như này, đó là lỗi chia cho 0.Bình thường theo các bài trước, các bạn sẽ dùng if, else để loại bỏ, in ra lỗi. (tất nhiên nếu bạn đã biết try catch rồi thì không nói ). Đọc xong bài này, các bạn sẽ có thêm 1 cách khác, và tất nhiên nó còn sử dụng để bắt và xử lý nhiều loại lỗi hơn!Ví dụ: Các bạn xem đoạn code này trước khi đọc lý thuyết, chạy thử nó, có thể nó cũng khá dễ hiểu! PHP: package javaandroidvn;public class JavaAndroidVn {    public static void main(String[] args) {        int a = 5;        int b = 0;        //Cách các bài trước thường làm, dùng if, else:        if (b == 0) {            System.out.println("Lỗi chia cho 0");        } else {            System.out.println("a/b = " + a / b);        }        System.out.println("\nCách dùng try - catch - finally \n");        //Sử dụng try, catch để bắt lỗi:        try {            System.out.println("a/b = " + a / b);        } catch (Exception e1) {            System.out.println("Có lỗi gì đó xảy ra  ");            System.out.println("Tên lỗi là: " + e1);        } finally {            System.out.println("Có lỗi hay không thì cái dòng cuối cùng này vẫn được in ra!");        }    }} 1,...