NEP -DAA -DESIGN AND ANALYSIS OF ALOGRITHM

PROGRAM 1 PROGRAM 2 PROGRAM 3 PROGRAM 4 PROGRAM 5 PROGRAM 6 PROGRAM 7 PROGRAM 8 PROGRAM 9 PROGRAM 10 PROGRAM 11 PROGRAM 12

PART B

PROGRAM B1 PROGRAM B2 PROGRAM B3 PROGRAM B4 PROGRAM B5 PROGRAM B6 PROGRAM B7 PROGRAM B8 . . .

 
  
 
 
 
 
 
/* B1:
Program to catch Negative Array Size Exception. This exception is caused when the
array is initialized to negative values.*/

class programb1

{

public static void main(String as[])

{

        int arrSize = -8;
        try {

            int[] myArray = new int[arrSize];

        } catch (NegativeArraySizeException ex) {

            System.out.println("Can't create array of negative size");
        }

}
}