试题与答案

基本的线程控制包括终止线程、测试线程状态、 【9】 。

题型:填空题

题目:

基本的线程控制包括终止线程、测试线程状态、 【9】

答案:

参考答案:线程的暂停和恢复

解析: 基本的线程控制包括终止线程、测试线程状态、线程的暂停和恢复。
终止线程——线程终止后,其生命周期结束了,即进入死亡态,终止后的线程不能再被调度执行,以下几种情况,线程进入终止状态,线程执行完其run()方法后,会自然终止;通过调用线程的实例方法stop()来终止线程。
测试线程状态——可以通过Thread中的 isAlive()方法来获取线程是否处于活动状态;线程由start()方法启动后,直到其被终止之间的任何时刻,都处于Alive状态。线程的暂停和恢复——有几种方法可以暂停一个线程的执行,在适当的时候再恢复其执行。
join()方法,当前线程等待调用该方法的线程结束后,再恢复执行。

试题推荐
题型:单项选择题

I was a single parent of four small children, working at a low paid job. Money was always tight, but we had a (1) over our heads, food on the table, clothes on our backs, and if not a lot, always (2) . Not knowing we were poor, my kids just thought I was (3) . I’ve always been glad about that.

It was Christmas time, and although there wasn’t (4) for a lot of gifts, we planned to celebrate with a family party. But the big (5) for the kids was the fun of Christmas (6) .

They planned weeks ahead of time, asking (7) what they wanted for Christmas. Fortunately, I had saved MYM120 for (8) to share by all five of us.

The big (9) arrived. I gave each kid a twenty-dollar bill and (10) them to look for gifts of about four dollars each. Then everyone scattered. We had two hours to shop; then we would (11) back at the "Santa’s Workshop".

Driving home, everyone was in high Christmas spirits, (12) my younger daughter, Ginger, who was unusually (13) . She had only one small, flat bag with a few candies—fiftycent candies! I was so angry, but I didn’t say anything (14) we got home. I called her into my bedroom and closed the door, (15) to be angry again. This is what she told me.

"I was looking (16) thinking of what to buy, and I (17) to read the little cards on the ’Giving Trees’. One was for a little girl, four years old, and all she (18) for Christmas was a doll. So I took the card off the tree and (19) the doll for her. We have so much and she doesn’t have anything. "

I never felt so (20) as I did that day.

14()

A.since 

B.after 

C.while 

D.until

查看答案
微信公众账号搜索答案