Page 1 of 1

About Question enthuware.ocpjp.v21.2.4025 :

Posted: Sat Dec 21, 2024 4:48 pm
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?

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

Posted: Sun Dec 22, 2024 4:04 am
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.

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

Posted: Sun Dec 22, 2024 11:11 am
by dameest
Well, that's definitely a tricky one...

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

Posted: Sun Dec 22, 2024 11:03 pm
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.