public Throwable(String message)构造函数包含getMessage()方法,用来返回带参数构造函数创建异
public Throwable(String message)构造函数包含getMessage()方法,用来返回带参数构造函数创建异常时的【 】,对无参数构造函数而言,用它返回的是空值。
public Throwable(String message)构造函数包含getMessage()方法,用来返回带参数构造函数创建异常时的【 】,对无参数构造函数而言,用它返回的是空值。
下列程序的输出结果是______。
public class Example{
String str=new String("good");
char ch[]={'a','b','c');
public static void main(String args[]){
Example ex=new Example();
ex.change(ex.str,ex.ch);
System.out.printin(ex.str"and"ex.ch);
}
public void change(String str,char ch []){
str="test ok"; ch[0]='g';
}
)
A.good and abc B.good and gbc
C.test ok and abc D.test ok and gbc
下列程序运行的结果为:
public class Example{
String str=new String("good");
char[] ch={'a','b','c'};
public static void main(String args[]){
Example ex=new Example();
ex.change(ex.str,ex.ch);
System.out.print(ex.str+" and ");
Sytem.out.print(ex.ch);
}
public void change(String str,char ch[]){
str="test ok";
ch[0]='g';
}
}
A. good and abc
B. good and gbc
C. test ok and abc
D. test ok and gbc
A.true,false
B.true,true
C.false,true
D.false,false
下列程序实现的功能是当按下键盘时,在Applet中通过painnt()方法,在(50,50)位置处显示出按下的键的名称。在横线处填写正确的语句。 import java.awt.*; import java.awt.event.*; import java.applet.*; public class Test7 extends Applet { String str=" "; public void init() { addKeyListener (new KeyAdapter() { public void keyPressed(KeyEvent ke) { 【 】; repaint(); } }); requestFocus(); } public void paint(Graphics g) { g.drawString("你按下的键是:"+str,50,50); } { str=-ke.getKeyText(ke.getKeyCode())
下列程序实现的功能是当按下键盘时,在Applet中通过paint()方法,在(50,50)位置处显示出按下的键的名称。在横线处填写正确的语句。 import java.awt.*; import java.awt.event.*; import java.applet.*; public class Test7 extends Applet { String str=""; public void init() { addKeyListener (new KeyAdapter() { public void keyPressed(KeyEvent ke) { 【 】; repaint(); } }); requestFocus(); } public void paint(Graphics g) { g.drawString("你按下的键是:" +str, 50,50); } }