Why is there no output when otherMethod is called?
A.
An exception other than IOException is thrown.
B.
Standard error is not mapped to the console.
C.
There is a compilation error.
D.
The exception is suppressed.
Explanation:
C: wenn printStackTrace() ohne Referenz auf das Exception object aufgerufen
A : java.io.FileNotFoundException: wenn e.printStackTrace();
The code compiles fine
The line
FileInputStream fis = new FileInputStream(file))
will fail at runtime since file is an empty string.
Note:
public void printStackTrace()
Prints this throwable and its backtrace to the standard error stream.
Should be B
Nope, should be C. printStacktrace() is not a method. printStacktrace() is a method of Exception, so for it to work it should be e.printStacktrace().
+1
C
D
a