You are on page 1of 3

Exception handling

Nama:Andre Firmansyah

No.absen:05

Kelas:XI RPL A

public class Exception_handling {

public static void main(String[] args) {

int[] nomor = {1, 2, 3};

System.out.println(nomor[10]);

Hasil:
Dengan Exception Handling:

public class Exception_handling {

public static void main(String[] args) {

try {

int[] nomor = {1, 2, 3};

System.out.println(nomor[10]);

} catch(Exception e) {

System.out.println("Terjadi kesalahan.");

finally {

System.out.println("Penanganan masalah sudah selesai.");

You might also like