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
B. Provides a set of standard exceptions that covers all the possible errors
C. Improves the program structure because the programmer can choose where to handle exceptions
D. Improves the program structure because exceptions must be handled in the method in which they occurred
E. Allows the creation of new exceptions that are tailored to the particular program being created
Given:
What is the result?
A. Area is 6.0
B. Area is 3.0
C. Compilation fails at line n1
D. Compilation fails at line n2.
Given the code fragment Which code fragments, inserted independently, enable the code compile?
A. t.fvar = 200;
B. cvar = 400;
C. fvar = 200; cvar = 400;
D. this.fvar = 200; this.cvar = 400;
E. t.fvar = 200; Test2.cvar = 400;
F. this.fvar = 200; Test2.cvar = 400;
Given:
public class Marklist {
int num;
public static void graceMarks(Marklist obj4) {
obj4.num += 10;
}
public static void main(String[] args) {
MarkList obj1 = new MarkList();
MarkList obj2 = obj1;
MarkList obj1 = null;
obj2.num = 60;
graceMarks(obj2);
}
}
How many objects are created in the memory runtime?
A. 1
B. 2
C. 3
D. 4
Given the code fragment:
What could expression1 and expression2 be, respectively, in order to produce output ?, 16?
A. + +a, - -b
B. + +a, b-
C. A+ +, - - b
D. A + +, b -
Given the code fragment:
What is the result?
A. 28false29 true
B. 285 < 429 true
C. true true
D. compilation fails
Given the code fragment:
What is the result?
A. An exception is thrown at runtime.
B. 07-31-2014
C. 2014-07-31
D. 2014-09-30
Given:
What is the result?
A. String main 1
B. An exception is thrown at runtime
C. String main 1 2 3
D. String main 123
Given:
What is the result?
A. myStr: 7007, myNum: 7007
B. Error
C. myStr: 9009, myNum: 7007
D. myStr: 7007, myNum: 9009