Can you help me with this Java Question? Can you help me with this Java Question
ID: 3877344 • Letter: C
Question
Can you help me with this Java Question? Can you help me with this Java Question? Question 9 (1 point) Which of the following correctly defines a method that passes an exception back to the caller? public void average(int [] data) throws Exception OI/ code to do some work here if (// some error check test here ) throw Exception( //errstring ) /I code to do more work here public void average(int [] data) throw Exception II code to do some work here if ( // some error check test here ) throws new Exception(//errstring); I/ code to do more work here public void average(int [] data) throws Exception // code to do some work here if (// some error check test here ) throw new Exception(//errstring ) // code to do more work here O All of these work just fine.Explanation / Answer
9)anser C
public void average(int []data)throws Exception//should write throws here
{
//if(d==0)
//throw new Exception("helllo");//throw and new here
}
7)answer A
any code that can cause exception to thrown
code that can able get exception
8)answer A
The rest of the code insdie the try block is skipped.The code in the first cach block that matches the exception type is executed. If there is a finally block, then that code is executed. Then whatever code follows the finally block is executed.