Q85.What is the result of attempting to compile and run the following program?2 C- k" n8 A8 k6 p
1. public class Test {! b `1 S& p0 G- {$ h' _( ?. T( k
2. private int i = j;
) R+ u9 w- Y8 a3 x0 V8 j 3. private int j = 10;
4 f+ K/ _5 [, n/ j 4.: ?% d7 Q- Y. R
5. public static void main(String args[]) {0 q( m' Y3 L7 }4 g0 P0 _4 L
6. System.out.println((new Test()).i);
% u; }% h+ F! f8 n& u7 w* l# ` 7. }
. [9 |' a0 F: O4 P; H3 p 8. }
! r9 i# [- [4 f3 f( S [Select one correct answer]
$ ^; x- E: \8 X% a/ V9 c' p4 K a. Compiler error complaining about access restriction of private variables of Test.! m# d6 A8 s7 [/ ^
b. Compiler error complaining about forward referencing.
" Q; w O+ C3 b c. No error - The output is 0;: u9 j* B e, s4 c
d. No error - The output is 10;# B+ D4 v: `1 [; w0 j' Y" E
Q86.What is the result of attempting to compile and run the following program
0 N7 w' G+ g! u b. h) m9 H9 A 1. public class A {! }: _+ a# T& L5 R l& I" N
2. private void method1() throws Exception {$ G8 U0 b6 G. ]* \% s
3. throw new RuntimeException();
. M3 [; H% p) r' ^ 4. }: o0 v9 U7 b. r
6. public void method2() {1 [! |2 l& r; K6 i4 g' |
7. try {
& P& z! y1 `* u3 X% m/ H 8. method1();
( m* S- S! F c) G 9. } catch(RuntimeException e) {1 E9 G1 [$ x- z, {2 L) v
10. System.out.println(“Caught Runtime Exception”);
( q9 o t, L* a/ x( s 11. } catch(Exception e) {' L, m- a* X( z
12. System.out.println(“Caught Exception”);2 a7 b; } u8 M/ U3 e4 i+ c$ r/ L8 I
13. }
8 x: d, S! W* K, H4 p) K, A/ Z9 j$ w' T4 C7 h
14. } |