问题 问答题

下面的程序的功能是利用实现Runnable接口的方法来创建线程,并利用它来执行响应的一些操作。最后使得m的执行结果为100。 注意:请勿改动main()主方法和其他已有的语句内容,仅在下划线处填入适当的语句。 源程序文件代码清单如下: class ClassName implements Runnable { int n; ______ { try { Thread.sleep(2000); n=100; }catch(Exception e) {} } public static void main(String args[]) { try { ClassName a=new ClassName(); _____ thread1.start(); thread1.join(); int m=a.n; System.out.println("m="+m); }catch(Exception e) {} } }

答案

参考答案:

解析:public void run()Thread thread1=new Thread(a); 本题主要考查Java中对线程的创建知识。解答本题的关键是熟练掌握如何创建线程的知识。一般情况下,创建线程的方法是:①通过继承Thread类创建线程:②通过向Thread()构造方法传递Runnable对象来创建线程。在本题中,public void run()声明语句是用来声明线程体的,这是创建一个线程的必须做的。Thread thread1=new Thread(a)语句的功能是通过向Thread()构造方法传递Runnable对象a来生成一个对象thread1。最后程序的输出结果如下图所示。

阅读理解

阅读理解。

     At one time it was the dream of many little girls to become a nurse.Today, however, America is facing its

worst nurse shortage since World War I. Recently about 2, 000, 000 nurses are needed and 60 percent of all

hospitals in the US have shortages large enough to threaten(= say that you will hurt somebody ff they don't do

what you want)the quality of care provided. The demand for nurses spreads widely throughout the nursing

field.   

     What has become of these women in white? The answer lies in not one but several causes. One possibility

is the fact that woman have greater career options (职业选择). In the past, women who chose to work outside

the home had two basic choices: nursing or teaching. Today, more women than ever are in the work force, but

their options have greatly increased. There are women doctors, lawyers, firefighters and police officers. In fact,

women today are found in nearly every field of work. Nursing has been left behind, as women move on to jobs

with higher pay and greater status (地位). A woman or man in the nursing field is often looked down upon as

"merely a nurse". Teachers may be also at fault. Many high school students are actually being steered (劝导)

away from nursing, told by teachers that they are"too bright to be a nurse".   

     Americans are living longer than ever and requiring more medical attention. In fact, the number of elderly

patients has almost doubled in the past twenty years. Obviously a larger population requires more nurses. AIDS

and other diseases have caused more and more people to need nursing care. Usually fatal diseases mean long

drawn-out hospital stay, that is to say, more nurses are needed to care for these patients. It is estimated that

the demand for nurses will be doubled the supply in the coming ten years.

1. Why is America facing its worst nurse shortage?   

A. Because the demand of nurses has been doubled.   

B. Because more and more women prefer to be teachers and doctors.   

C. Because women have been provided with many different jobs.   

D. Because women no longer choose to be nurses.   

2. The passage tells us that high school teachers are at fault for _____.   

A. not mentioning the worst nurse shortage in the US   

B. introducing jobs with higher pay and greater status to their students   

C. not asking the government to raise the nurses' payment   

D. persuading the students not to be nurses   

3. The author wrote this passage in order to ______.   

A. describe the unequal treatment of women in the US   

B. warn people to pay more attention to the nursing problem   

C. tell us women's free choice of jobs today   

D. call on women not to be nurses   

4. Which of the following is true according to the passage?   

A. high school students think themselves too bright to be nurses.   

B. Women in the US have greater career choice than those in other countries.   

C. Of all the hospitals in the world 60 percent more nurses are badly needed.   

D. Nursing used to be a popular job among women.

单项选择题