谁能帮我把这个程序作业给做一下的啊?谢谢的啊!

来源:百度知道 编辑:UC知道 时间:2024/06/06 14:56:47
1.请说明下列语句
try{
class.Name(“sun.jdbc.odbc.JdbcOdbcDriver”);
}
Catch(java.lang.ClassNoFoundException e){
System.out.println(“Can not load Jdbc-Odbc Bridge
Driver. ”);
System.out.err.print(“ClassNoFoundException: ”);
System.out.err.print(e.getMeesgae());
}
完成什么任务?为何要把它放在Try-Catch语句内?

2.请指出下述程序中3个this分别指的是什么?(提示:如程序中注释所给出的那样,可分别用this1、this2、this3表示。)
public class MultiEventTest extends Frame
implements WindowLiastener, MouseListener, KeyListener{
public multiEventtest(){
addWindowListener(this); // this1 = ?
addMouseListener(this); // this2 = ?
addKeyListener(this); // this3 = ?
}

}

3.定义一个学生类Student,其中包含成员变量:学号(num)、姓名(name)、年龄(year)、性别(sex)和一个获取学生姓名的方法(getName)方法,让它能够在控制台上显示学生的姓名即可。

4.已知KeyAdapterKey适配器类的定义为:
public class KeyAdapter(){
public void keyPressed(KeyEvent e){};
public void keyReleased(KeyEvent e){};
pu

1,2,4在别的地方回答过你了,只说3

class Student {
long num;
String name;
int year;
String sex;
String getName() {
return name;
}
}
要在控制台显示,先调用getName再print就可以了
其他地方属性的类型,要是觉得不妥改掉就可以了