problem /this code might have string tobuy shoppinglist[index]catch (arrayindexoutofboundsexception aioobxsystem out println("the index "+index+is outside the array ")if this code does not catch thrown exceptionthe flow of control will immediately exit the method and return to the code that called our method therethe java runtime environment will look again for catch block if there is no catch block in the code that called this methodthe flow of control will jump to the code that called thisand so on eventuallyif no code catches the exceptionthe java run-time system (the origin of our program' flow of controlwill catch the exception at this pointan error message and stack trace is printed to the screen and the program is terminated the following is an actual run-time error messagejava lang nullpointerexceptionreturned null locator at java awt component handleevent(component java: at java awt component postevent(component java: at java awt component postevent(component java: at sun awt motif mbuttonpeer action(mbuttonpeer java: at java lang thread run(thread javaonce an exception is caughtthere are several things programmer might want to do one possibility is to print out an error message and terminate the program there are also some interesting cases in which the best way to handle an exception is to ignore it (this can be done by having an empty catch block