Course Solutions Uncategorized (Solved) : Add Short Comments Describes Code Static Int Safeadd Int Left Int Right Right 0 Left Integ Q32904569 . . . .

(Solved) : Add Short Comments Describes Code Static Int Safeadd Int Left Int Right Right 0 Left Integ Q32904569 . . . .

 

Add short comments which describes this code

static intsafeAdd(int left, int right)

   {

       if (right <0) {

          if(left >Integer.MAX_VALUE – right) {

              throw newArithmeticException(“Integer overflow”);

           }

       }

       else {

          if (left <Integer.MIN_VALUE – right) {

              throw newArithmeticException(“Integer overflow”);

           }

       }

       return left +right;

   }

  

Expert Answer


An answer will be send to you shortly. . . . .

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post