Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Class untuk penanganan error dengan try, catch dan finally keyword
- *
- * @author Ahmad Lamaul Farid
- * @version 24 Desember 2020
- */
- public class Main
- {
- public static void main(String[] args) {
- try
- {
- int[] myNumbers = {1, 2, 3};
- System.out.println(myNumbers[10]);
- }
- catch (Exception e)
- {
- System.out.println("Something went wrong.");
- }
- finally
- {
- System.out.println("The 'try catch' is finished.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement