Q.– Given:-
public class Test {
void readCard (int cardNo) throws Exception {
System.out.println("Reading Card");
}
void checkCard(int cardNo) throws RuntimeException { // line n1
System.out.println("Checking Card");
}
public static void main(String[ ] args) {
Test ex = new Test( );
int cardNo = 12344;
ex.readCard (cardNo); // line n2
ex.checkCard(cardNO); // line n3
}
}
What is the result?
A) Compilation fails only at line n1.
B) Compilation fails only at line n3.
C) Reading Card
Checking Card
D) Compilation fails only at line n2.
E) Compilation fails at both line n2 and line n3.
⧪ please give your answer in a comment section.
public class Test {
void readCard (int cardNo) throws Exception {
System.out.println("Reading Card");
}
void checkCard(int cardNo) throws RuntimeException { // line n1
System.out.println("Checking Card");
}
public static void main(String[ ] args) {
Test ex = new Test( );
int cardNo = 12344;
ex.readCard (cardNo); // line n2
ex.checkCard(cardNO); // line n3
}
}
What is the result?
A) Compilation fails only at line n1.
B) Compilation fails only at line n3.
C) Reading Card
Checking Card
D) Compilation fails only at line n2.
E) Compilation fails at both line n2 and line n3.
⧪ please give your answer in a comment section.
4 Comments
b
ReplyDeleteB
ReplyDeleteC
ReplyDeleteE
ReplyDelete