About Question enthuware.ocpjp.v21.2.4025 :

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

Moderator: admin

Post Reply
dameest
Posts: 16
Joined: Sat Nov 30, 2024 5:27 am
Contact:

About Question enthuware.ocpjp.v21.2.4025 :

Post by dameest »

Virtual threads are instances of java.lang.VirtualThread class. VirtualThread extends BaseVirtualThread, which in turn extends Thread. Although VirtualThread is-a Thread, it is not correct to say that a virtual thread is an instance of the Thread class.

I don't get it. C extends B, B extends A, and you are saying here that C is not instance of A? will the instanceof operator fail to identify VirtualThread as Thread?
Last edited by dameest on Sun Dec 22, 2024 11:09 am, edited 1 time in total.

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

Re: About Question enthuware.ocpjp.v21.2.4025 :

Post by admin »

No, that is not what it is saying.

VirtualThread is-a Thread <--- Correct because VirtualThread does extend indirectly from Thread

VirtualThread is an instance of the Thread class <-- Not correct because you don't do new Thread() to create a VirtualThread

new Thread() <---- This creates an instance of the Thread class
new VirtualThread() <---- This would theoretically create an instance of a VirtualThread class but of course there is no such constructor so this is wrong.

dameest
Posts: 16
Joined: Sat Nov 30, 2024 5:27 am
Contact:

Re: About Question enthuware.ocpjp.v21.2.4025 :

Post by dameest »

Well, that's definitely a tricky one...

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

Re: About Question enthuware.ocpjp.v21.2.4025 :

Post by admin »

Yes, I agree. unfortunately as the comment under the option notes, a similar ambiguous statement was seen in the real exam. We just want to make sure that the candidate is aware of the situation.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 9 guests