Be on schedule. Score better.


Solved! Get answer or ask a different Question 6971

Please look over and construct a solution for #1 and #2

   public static void main(String args[]){

       int a,b,c;      // We define variables of type integer namned a, b, and c.

       try {         // We set up the try check block. We will be looking for an invalid value for integer c

            a=0;      // Now we assign values to the variables.


            c=b/a;      // The result of dividing a number by 0 is undefined. Exception!

            System.out.println(“This line will not be executed when a=0 because when a=0, the previous line throws an exception to the catch block.”);     


       catch(ArithmeticException e) { // As soon as an exception is thrown in the “try” block, execution of this code begins.

            System.out.println(“Catching this exception thrown by the try block: ” + e);


      System.out.println(“Execution resumes here after both the try and catch blocks execute.”);


  1. What are the results of the program as written?
  2. What results would the program produce if you changed the value of a from 0 to 3?
Looking for a Similar Assignment? Our ENL Writers can help. Use the coupon code FIRST15 to get your first order at 15% off!
Students Love Us

Hi there! Click one of our representatives below and we will get back to you as soon as possible.

Chat with us on WhatsApp