填空题请将下面程序补充完整。
public class PowerCalc{
public static void main(String[]args){
double x=5.0;
System. out. println(x+"to the power 4 is"+power(x, 4));
System. out. println("7. 5 to the power 5 is"+power(7.5, 5));
System. out. println("7.5 to the power 0 is"+power(7.5, 0));
System. out. println("10 to the power -2 is"+power(10, -2));
}
static double{{U}} 【11】 {{/U}} (double x, int n){
if(n>1)
return x * power(x, n-1);
else if(n<0)
return 1.0/power(x, -n);
else
return n==0 ? 1.0:x;
}
}
填空题类是由成员变量和{{U}} 【9】 {{/U}}组成。
填空题使用 【13】 API来访问数据库使得数据库应用程序不依赖于特定的数据库厂家。
填空题移位运算符包括算术右移运算符______、算术左移运算符______和逻辑右移运算符______。
填空题如果有一个类MyFrame是Frame的子类,但它不能被实例化,请写出该类的声明头:______。
填空题Applet与Application的主要区别在于执行方式上:Application以main()方法为入口点运行,而Applet要在 【15】 或appletviewer中运行。
填空题执行下面的程序段,辅出结果为上 【8】 。 public class Q public static void main (String argv[]) int anar[]=new int[5]; System.out.pfintln(anar[0]);
填空题bar为一JScrollBar组件,阅读下面程序段,请在程序中的画线处填入正确的语句使程序能够正确运行。
...
public WellAdjusted()
{
super("Well Adjusted");
setSize(350,100);
bar.addAdjustmentListener(this);
value.setHorizontalAlignment(SwingConstants.CENTER);
value.setEditable(false);
JPanel pane = new JPane();
pane.setLayout(new BorderLayout());
pane.add(value,"Center"):
pane.add(bar,"South");
setContentPane(pane);
}
public void adjustmentValueChanged(AdjustmentEvent evt)
{
{{U}}【12】 {{/U}}
if(source ==bar)
{
int newValue bar.getValue();
value.setText(""+newValue);
}
repaint();
}
填空题switch语句中的表达式的值只能是int、byte、short和______型的值。
填空题执行下面的赋值语句后,a的值为{{U}} 【8】 {{/U}}。
a=Float.valueOf("12.34").fioatValue();
填空题软件危机出现于60年代末,为了解决软件危机,人们提出了{{U}} 【3】 {{/U}}的原理来设计软件,这就是软件工程诞生的基础。
填空题关键字 【3】 表明一个变量在初始化后不能被修改。
填空题阅读下列程序段
public class OperatorsAndExpressions {
String conditionalExpression(int score) {
String result;
//如果score超过60分, 则结果是passed, 否则是doesn't pass
result=-(score>=60)?"passed":"doesn't pass";
System.out.println(result);
retum result;
}
public static void main(String args[]) {
OperatorsAndExpressions OperAndExp=new OperatorsAndExpressions();
//条件表达式
OperAndExp.conditionalExpression(65);
}
}
其执行结果是{{U}} 【8】 {{/U}}。
填空题将一个对象wait poll中的一个线程移入lock pool中的方法是______。
填空题某二叉树中度为2的结点有18个,则该二叉树中{{U}} 【1】 {{/U}}个叶子结点。
填空题在实现Serializable的类中,静态变量和使用 【13】 关键字可以使某些数据不被串行化。
填空题Java的线程调度策略是基于{{U}} {{U}} {{/U}} {{/U}}的抢占式。
填空题Swing的事件处理机制包括______、事件和事件处理者。
填空题下列程序中,实例tat是监听器,fr是事件源,fr上发生的事件委托tat进行处理。程序的执行结果是显示一个粉红色的窗口,单击关闭按钮,可关闭窗口。请填完整程序。
import java.awt.*;
importjava.awt.event.*;
public class Testppp
{
public static void main(String args[ ])
{
Frame fr=new Frame("The Adapter!”);
TheAdapterTest tat=new TheAdapterTest( );
fr 【 】
fr.setSize(200,200);
fr.setBackground(Color.pink);
fr.setVisible(true);
}
}
class TheAdapterTest extends WindowAdapter
=
public void windowClosing(WindowEvent e)
{
System.exit(1);
}
=
填空题语句 Thread thread1=new SomeThreadClass( ) 成功运行后, 线程thread1 处于生命周期的________ 状态