Given below the sample code :
1. class SuperClass{
2. public void Function(Ingredient[] list) throws XXX
3. {
//body of the Function
N. } }
The code above throws two exceptions ' ArrayIndexOfBoundException ' , ' NullPointerException '.Which given below statement can replace line number 3 ?
1. public void Function(Ingredient[] list) throws BaseException
2. public void Function(Ingredient[] list) throws
ArrayIndexOfBoundException, NullPointerException
3. public void Function(Ingredient[] list) may throw NullPointerException
4. public void Function(Ingredient[] list)
(1) &(2)
BaseException is more general than ArrayIndexOfBoundException or NullPointerException .
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.