Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package main;
- /**
- *
- * @author markjasongalang
- */
- class FindArray {
- public void FindArrayFunction(int[] array, int array_size) {
- try {
- for (int i = 0; i < array_size; i++) {
- System.out.print(array[i] + " ");
- }
- System.out.println();
- } catch (ArrayIndexOutOfBoundsException e) {
- System.out.println("\nEncountered an array index out of bounds exception.");
- } catch (NullPointerException e) {
- System.out.println("\nEncountered a null pointer exception.");
- } catch (RuntimeException e) {
- System.out.println("\nEncountered a runtime exception.");
- }
- }
- }
- public class Main {
- public static void main(String[] args) {
- FindArray find_array_object = new FindArray();
- int[] array = {1, 2, 3, 4, 5};
- find_array_object.FindArrayFunction(array, array.length);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement