About Question com.enthuware.ets.scjp.v6.2.429 :

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

Moderator: admin

Post Reply
tanzwud
Posts: 19
Joined: Mon Sep 01, 2014 9:45 pm
Contact:

About Question com.enthuware.ets.scjp.v6.2.429 :

Post by tanzwud »

Which of the following calls will not stop a thread from executing ?
Assume that the thread is already started.

Why correct answer is

start()
It will throw an exception as the thread is already started.

As soon as we have exception, the thread will not execute any longer and it will stop a thread? Or I'm missing something.

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

Re: About Question com.enthuware.ets.scjp.v6.2.429 :

Post by admin »

That is not true. The caller thread will receive the exception. Not the thread on which you have called start. That will keep on running normally. Also, receiving an exception doesn't mean that the thread has stopped.
If you like our products and services, please help us by posting your review here.

tanzwud
Posts: 19
Joined: Mon Sep 01, 2014 9:45 pm
Contact:

Re: About Question com.enthuware.ets.scjp.v6.2.429 :

Post by tanzwud »

Many THX

TwistedLizard
Posts: 57
Joined: Sat Mar 01, 2014 1:48 pm
Contact:

Re: About Question com.enthuware.ets.scjp.v6.2.429 :

Post by TwistedLizard »

admin wrote:Also, receiving an exception doesn't mean that the thread has stopped.
But a thread that calls start() on itself, and must obviously have already been started in order to do so, will terminate? I believe I can demonstrate that.

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

Re: About Question com.enthuware.ets.scjp.v6.2.429 :

Post by admin »

Not necessarily. You can put the call to start() within a try/catch block.
If you like our products and services, please help us by posting your review here.

TwistedLizard
Posts: 57
Joined: Sat Mar 01, 2014 1:48 pm
Contact:

Re: About Question com.enthuware.ets.scjp.v6.2.429 :

Post by TwistedLizard »

admin wrote:Not necessarily. You can put the call to start() within a try/catch block.
Ah, I see thanks.

Post Reply

Who is online

Users browsing this forum: No registered users and 42 guests