Which three are advantages of the Java exception mechanism?
A.
Improves the program structure because the error handling code is separated from the normal
program function
null
B.
Provides a set of standard exceptions that covers all the possible errors
compilation fails
C.
Improves the program structure because the programmer can choose where to handle exceptions
Java.lang.NullPointerException
D.
Improves the program structure because exceptions must be handled in the method in which
they occurred
Exceptions do not need to be handled in the method where they occurred. They can be handled
in the method which is calling the method that throws an exception.
QUESTION 40
Given:
public class MyFor3 {
public static void main(String [] args) {
int [] xx = null;
System.out.println(xx);
}
What is the result?
0
E.
allows the creation of new exceptions that are tailored to the particular program being
D.
Improves the program structure because exceptions must be handled in the method in which
they occurred
Exceptions do not need to be handled in the method where they occurred. They can be handled
in the method which is calling the method that throws an exception.
QUESTION 40
Given:
public class MyFor3 {
public static void main(String [] args) {
int [] xx = null;
System.out.println(xx);
}
What is the result?
0
A.
Improves the program structure because the error handling code is separated from the normal
program function
null
B.
Provides a set of standard exceptions that covers all the possible errors
compilation fails
C.
Improves the program structure because the programmer can choose where to handle exceptions
Java.lang.NullPointerException
D.
Improves the program structure because exceptions must be handled in the method in which
they occurred
Exceptions do not need to be handled in the method where they occurred. They can be handled
in the method which is calling the method that throws an exception.
QUESTION 40
Given:
public class MyFor3 {
public static void main(String [] args) {
int [] xx = null;
System.out.println(xx);
}
What is the result?
0
Explanation:
A: The error handling is separated from the normal program logic.
C: You have some choice where to handle the exceptions.
E: You can create your own exceptions.
Incorrect answers:
B: The standard exceptions do not cover all possible errors.An array variable (here xx) can very well have the null value.
Note:
Null is the reserved constant used in Java to represent a void reference i.e a pointer to nothing.
Internally it is just a binary 0, but in the high level Java language, it is a magic constant, quite distinct
from zero, that internally could have any representation.
This test don´t work, I lost the exam, only 5 questions are of the test
this test don´t work, I failed the test, Don´t lost your time.
This question needs to be redone it’s all over the place and repeated
and mixed with another question