Why is there no output when otherMethod is called?

Given the code fragment: Why is there no output when otherMethod is called?

Given the code fragment: Why is there no output when otherMethod is called?

A.
The exception is suppressed.

B.
An exception other than IOException is thrown.

C.
Standard error is not mapped to the console.

D.
There is a compilation error.



Leave a Reply 3

Your email address will not be published. Required fields are marked *


nk

nk

should choose B
java.io.FileNotFoundException: (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:146)
at java.io.FileInputStream.(FileInputStream.java:101)
at com.lqd.Q11.printFile(Q11.java:17)
at com.lqd.Q11.otherMethod(Q11.java:13)
at com.lqd.Q11.main(Q11.java:9)

nmm

nmm

e.printstacktrace

Youri

Youri

As it is mentionned that we see a “code fragment”, who tells you that there’s not an additional method “printStackTrace()” that is not given here in this code fragment ?
So maybe it’s C, we don’t have an output, because the standart error is not mapped to the console ?
Or A, the exception is suppressed by the execution of the additional method “printStackTrace” ?

This question is not very clear.