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

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
BinSlayer
Posts: 10
Joined: Tue Jul 09, 2019 8:33 am
Contact:

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

Post 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

admin
Site Admin
Posts: 10053
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 49 guests