Page 1 of 1

About Question enthuware.ocpjp.ii.v11.2.3346 :

Posted: Wed Aug 07, 2019 5:21 am
by BinSlayer
Hi
The first answer choice is: "It is of type java.io.OutputStream.". It is wrong according to the Enthuware software.

However, just by looking inside the java code, we can see that a PrintWriter IS-A OutputStream. That also means instanceof operator would return true for example.
What's the catch here?

Thanks

Re: About Question enthuware.ocpjp.ii.v11.2.3346 :

Posted: Wed Aug 07, 2019 7:16 am
by admin
Yes, PrintStream is-a OutputStream but since the question is about the type the variable out, this option should not be selected. By this logic, if there were an option saying it is of type Object, then that would be correct as well. Also, the is-a test is to check the type of an object, not of a variable.