You are on page 1of 1

/*

* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to
change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Other/File.java to edit this
template
*/

/**
*
* @author alber
*/
import java.util.*;
public class T9N2_driver {

public static void main(String args[]) {


Scanner input=new Scanner(System.in);

int[] array = new int[100];


for (int i = 0; i < array.length; i++) {
array[i] = (int)(Math.random() * 100) + 1;
}

System.out.print("Enter index of element inside the array : ");


try{
System.out.print("The element is "+ array[input.nextInt()] );
}
catch(ArrayIndexOutOfBoundsException e){
System.out.print("Out of Bounds");
}
}
}

You might also like