问题 单项选择题

下列说法正确的是

A.共享数据的所有访问都必须作为临界区

B.用synchronized保护的共享数据可以是共有的

C.Java中对象加锁不具有可重入性

D.对象锁不能返还

答案

参考答案:A

解析: 本题考查对象加锁的相关概念。对于对象加锁的使用有些注意事项。对象的锁在某些情况下可以由持有线程返还,比如当 synchronized语句块执行完成后;当在 synchronized语句块中出现异常;当持有锁的线程调用该对象的wait()方法,由此可见选项D说法错误。共享数据的所有访问都必须作为临界区,使用 synchronized进行加锁控制,选项A说法正确。用 synchronized保护的共享数据必须是私有的,选项B说法错误。Java中对象加锁具有可重入性,选项C说法错误。

选择题
单项选择题

Drug use is rising dramatically among the nation’s youth after a decade of decline. From 1993 to 1994, marijuana use among young people (1) from 12 to 17 jumped 50 percent. One in five high school seniors (2) marijuana daily. Monitoring the Future, which (3) student drug use annually, reports that negative attitudes about drugs have declined for the fourth year in a row. (4) young people see great risk in using drugs. Mood-altering pharmaceutical drugs are (5) new popularity among young people. Ritalin, (6) as a diet pill in the 1970s and now used to (7) hyperactive children, has become a (8) drug on college campuses. A central nervous system (9) , Ritalin can cause strokes, hypertension, and seizures. Rohypnol, produced in Europe as a (10) tranquilizer, lowers inhibitions and suppresses short-term memory, which has led to some women being raped by men they are going out with. (11) taken with alcohol, its effects are greatly (12) . Rock singer Kurt Cobain collapsed from an (13) of Rohypnol and champagne a month before he committed (14) in 1994. In Florida and Texas, Rohypnol has become widely abused among teens, who see the drug as a less expensive (15) for marijuana and LSD. Alcohol and tobacco use is increasing among teenagers, (16) younger adolescents. Each year, more than one million teens become regular smokers, (17) they cannot legally purchase tobacco. By 12th grade, one in three students smokes. In 1995, one in five 14-year-olds reported smoking regularly, a 33 percent jump (18) 1991. Drinking among 14-year-olds climbed 50 percent from 1992 to 1994, and all teens reported substantial increases in (19) drinking. In 1995, one in five 10th graders reported having been drunk in the past 30 days. Two-thirds of high school seniors say they know a (20) with a drinking problem.

2()

A.tastes

B.smokes

C.injects

D.takes