
Here is my code. what is the output if a. the value of lowerLimit is 50? b. if the value of lowerLimit is 150?
int lowerLimit; ... try { System.out.println("Entering the try block.");
if (lowerLimit < 100)
throw new Exception("Lower limit violation.");
System.out.println(Exiting the try block.");
}
catch (Exception e) { System.out.println("Exception: " + e.getMessage()); }
System.out.println("After the catch block");

When we put 50 as a lower limit value, output comes:
Entering the try block. Lower limit violation. After the catch block
When we put 150 as a lower limit value, output comes:
Entering the try block. Exiting the try block. After the catch block
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.