Question: Which is output when inputVal is 0 ? try { inputVal = scnr . nextInt ( ) ; if ( inputVal 0 ) { }

Which is output when inputVal is 0?
try {
inputVal = scnr.nextInt();
if (inputVal 0){
}
throw new Exception("Input should be positive");
}
System.out.print("Input squared: "+ inputVal * inputVal);
catch (Exception e){
}
System.out.print(e.getMessage());
Input should be positive
Input squared: 0
Input squared: 0
Input should be positive
Exception
 Which is output when inputVal is 0? try { inputVal =

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!