题目内容

Swing GUI使用两种类型的类,即GUI类和 【13】 支持类。

查看答案
更多问题

在15~18℃时,60号石油沥青用铁锤击时,不会碎裂而只是变形。

A. 对
B. 错

[说明] 类Queue表示队列,类中的方法如表4-12所示。 表4-12 类Queue中方法说明表方法说明IsEmpty()判断队列是否为空,如果队列不为空,返回true;否则,返回falseEnqueue(object NewNode)入队操作Dequeue()出队操作。如果队列为空,则抛出异常 类Node表示队列中的元素;类EmptyQueueException给出了队列中的异常处理操作。 [Java代码] public class testmain { //主类 public static viod main (string args[]) { Queue q= new Queue; q.enqueue("first!"); q.enqueue("second!"); q.enqueue("third!"); (1) { while(true) system.out.println(q.dequeue()); } catch( (2) ) { } } public class Queue { //队列 node m_firstnode; public Queue(){m_firstnode=null;} public boolean isempty() { if (m_firstnode= =null) return true; else return false; } public viod enqueue(object newnode) { //入队操作 node next = m_firstnode; if (next = = null) m_firstnode=new node(newnode); else { while(next.getnext() !=null) next=next.getnext(); next.setnext(new node(newnode)); } } public object dequeue() (3) { //出队操作 object node; if (is empty()) (4) else { node =m_firstnode.getobject(); m_firstnode=m_firstnode.getnext(); return node; } } } public class node{ //队列中的元素 object m_data; node m_next; public node(object data) {m_data=data; m_next=null;} public node(object data,node next) {m_data=data; m_next=next;} public void setobject(object data) {m_data=data; } public object getobject(object data) {return m_data; } public void setnext(node next) {m_next=next; } public node getnext() {return m_next; } } public class emptyqueueexception extends (5) { //异常处理类 public emptyqueueexception() { system. out. println ( "队列已空!" ); } }

下面程序的输出结果是 ( )public class ex2 public static void main(String []args) for(int cnt=1;cnt<=10;cnt++) if(cnt<=5) continue; System.out.print(cnt+"");

A. 1 2 3 4
B. 6 7 8 9
C. 1 2 3 4 6 7 8 9 10
D. 6 7 8 9 10

Believe it or not, optical illusion (错觉) can cut highway crashes. Japan is a case in point. It has reduced automobile crashes on some roads by nearly 75 percent using a simple optical illusion. Bent stripes, called chevrons (人字形), painted on the roads make drivers think that they are driving faster than they really are, and thus drivers slow down. Now the American Automobile Association Foundation for Traffic Safety in Washington D.C. is planning to repeat Japan’’s success. Starting next year, the foundation will paint chevrons and other patterns of stripes on selected roads around the country to test how well the patterns reduce highway crashes. Excessive speed plays a major role in as much as one fifth of all fatal traffic accidents, according to the foundation. To help reduce those accidents, the foundation will conduct its tests in areas where speed-related hazards are the greatest — curves, exit slopes, traffic circles, and bridges. Some studies suggest that straight, horizontal bars painted across roads can initially cut the average speed of drivers in half. However, traffic often returns to full speed within months as drivers become used to seeing the painted bar. Chevrons, scientists say, not only give drivers the impression that they are driving faster than they really are but also make a lane spear to be narrower. The result is a longer lasting reduction in highway speed and the number of traffic accidents. The passage mainly discusses ________.

A. a new way of highway speed control
B. a new pattern for painting highways
C. a new approach to training drivers
D. a new type of optical illusion

答案查题题库