Answers for "try catch exception"

21

java try catch

try {
  // Code that may have error
} catch(ErrorName e){
  // Another code
}
Posted by: Guest on November-26-2019
7

try catch java

public class MyClass {
  public static void main(String[ ] args) {
    try {
      int[] myNumbers = {1, 2, 3, 4, 5, 6};
      System.out.println(myNumbers[10]);
    } catch (Exception e) {
      System.out.println("Something went wrong. check again");
    }
  }
}
Posted by: Guest on July-17-2020
6

try block in java

try {
  //  Block of code to try
}
catch(Exception e) {
  //  Block of code to handle errors
}
Posted by: Guest on May-02-2020
6

try catch exception

First try block try to handle it
if not then catch block will handle it.
Finally block will executed regardless
of the outcome
Posted by: Guest on January-05-2021
0

try catch

try {
  try_statements
}
catch (exception_var) {
  catch_statements
}
finally {
  finally_statements
}
Posted by: Guest on October-07-2021
0

try and exception

def loan_emi(amount, duration, rate, down_payment=0):
    loan_amount = amount - down_payment
    try:
        emi = loan_amount * rate * ((1+rate)**duration) / (((1+rate)**duration)-1)
    except ZeroDivisionError:
        emi = loan_amount / duration
    emi = math.ceil(emi)
    return emi
Posted by: Guest on July-18-2021

Browse Popular Code Answers by Language