阅读以下说明,Java代码将应填入(n)处的字句写在对应栏内。
【说明】
链表和栈对象的共同特征是:在数据上执行的操作与在每个对象中实体存储的基本类型无关。例如,一个栈存储实体后,只要保证最后存储的项最先用,最先存储的项最后用,则栈的操作可以从链表的操作中派生得到。程序6-1实现了链表的操作,程序6-2实现了栈操作。
import java.io.*;
class Node //定义结点
{ private String m_content;
private Node m_next;
Node(String str)
{ m_content=str;
m_next=null; }
Node(String str,Node next)
{ m_content=str;
m_next=next; }
String getData() //获取结点数据域
{ return m_content;}
void setNext(Node next] //设置下一个结点值
{ m_next=next; }
Node getNext() //返回下一个结点
{ return m_next; )
}
【程序6-1】
class List
{ Node Head;
List()
{ Head=null; }
void insert(String str) //将数据str的结点插入在整个链表前面
{ if(Head==null)
Head=new Node(str);
else
(1)
}
void append(String str) //将数据str的结点插入在整个链表尾部
{ Node tempnode=Head;
it(tempnode==null)
Heed=new Node(str);
else
{ white(tempnode.getNext()!=null)
(2)
(3) }
}
String get() //移出链表第一个结点,并返回该结点的数据域
{ Srting temp=new String();
if(Head==null)
{ System.out.println("Errow! from empty list!")
System.exit(0); }
else
{ temp=Head.getData();
(4) }
return temp;
}
}
【程序6-2】
class Stack extends List
{ void push(String str) //进栈
{ (5) }
String pop() //出栈
{ return get();}
}
China Seeks Donors to Narrow Bone Marrow Gap
1 China has launched a campaign to recruit more bone marrow donors, amid a shortage of funds as well as of sibling donors who could help the growing number of patients in need of lifesaving transplants, state media reported on Monday.
2 The Chinese Red Cross began the national campaign over the weekend to find donors for some 4 million patients suffering from leukaemia, thalassaemia and other blood diseases and awaiting bone marrow transplants, the official China Daily said. Every year China has 40,000 new leukaemia patients, most of them under 35 and 50 percent of them children, the newspaper said. Other reports have linked China's growing childhood leukaemia to solvents and building materials used in interior decoration.
3 With a tiny pool of bone marrow donors, weakened by the absence of sibling donors for most children because of China's one-child policy, doctors rely on donors from Taiwan to save many young leukaemia patients, the Beijing Evening News said last weekend. Taiwan, with a population of 22 million, has 210,000 registered donors compared with fewer than 30,000 donors among mainland China's 1.3 billion people, the newspaper said.
4 Yet the lack of registered donors may reflect a lack of funding for testing and recording data on potential donors rather than a lack of volunteers, the newspaper said. China needs a pool of at 1east 100,000 donors but testing them would cost more than 50 million yuan, it said.
5 The Hong Kong Marrow Match Foundation said it has helped "a handful" of patients in Beijing, Shanghai and other cities. "The number of requests is increasing" from mainland China, including direct calls to the charity from desperate patients or relatives, said the foundation's donor coordinator Marven Chin. But the cost of extracting bone marrow from one of the foundation's 40,000 registered donors and flying it by courier has to be borne by the patients, and many of them have to be aided financially, Chin said.
A Urgent Need for Both Donors and Funds
B Shortage of Donors
C Desperate Leukaemia Patients
D Seriousness of the Current Situation
E Shortage of Funds
F Comparison Between Mainland and Hong Kong and Taiwan
Paragraph 2 ______