Exceptions
- What is the output of this program?
public class Arithmetic_Exception
{
public static void main(String args[])
{
try
{
int p = args.length;
int q = 11 / p;
System.out.print(p);
}
catch (ArithmeticException e)
{
System.out.println("First");
}
}
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
First
- What is the use of try & catch?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
*It allows to fix errors.
*It prevents automatic terminating of the program in cases when an exception occurs
*It allows us to manually handle the exception
- Which of these keywords are used for the block to be examined for exceptions?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
try is used for the block that needs to checked for exception.
- Which of these keywords are used for the block to handle the exceptions generated by try block?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
catch
- Which of these keywords are used for generating an exception manually?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
throw