Page 1 of 1

About Question enthuware.ocpjp.v7.2.1254 :

Posted: Sat Jan 07, 2017 12:29 pm
by sir_Anduin@yahoo.de
How is "None of the above are correct" the correct answer if even the explanation says that:
A Thread is created by doing new ClassThatExtendsThread() OR by doing new Thread(classImplementingRunnable);
The newly created Thread is started by calling start().
As far as I understand you have to call the start() method on a Thread object to have a parall execution. This makes anser 1 correct for me.

Also the explanation for answer 1
The class can also implement Runnable.
does not make sense, because, if you call the run method of the Runnable it will be executed in the main thread.

Maybe I am missunderstanding the "To provide threading behavior" statement...

Thanks

Aleks

Re: About Question enthuware.ocpjp.v7.2.1254 :

Posted: Sat Jan 07, 2017 11:56 pm
by admin
When you are talking about threading behavior you are only talking in a general sense about how to write a class that can be used create threads. You can do that either by extending that class from Thread or making it implement Runnable so that you can pass it to new Thread( runnable ).

I agree with you that the statement, "threading behavior" is not very precise and can cause confusion.

Paul.