已采纳回答 / 禾只
public class Course { private String id,name; public Course(String id,String name){ this.id=id; this.name=name; } public Course() { // TODO Auto-generated constructor stub } public String getId(){ return id; } public void setId(String id){ this.id=i...
2015-09-02
处理异常(try-catch以及try-catch-finally):
a)try会抛出很多种类型的异常-多重catch块的处理
eg:try{
//一些会抛出异常的方法
}catch(Exception e){
//处理该异常的代码块
}catch(Exception2 e){
//处理Exception2的代码块
}..(n个catch块)..{
}finally{
//最终将要执行的代码
}
注意:顺序问题-按照从小到大,先子类后父类的顺序
e.g:InputMismatchException -> ArithmeticException -> Exception
a)try会抛出很多种类型的异常-多重catch块的处理
eg:try{
//一些会抛出异常的方法
}catch(Exception e){
//处理该异常的代码块
}catch(Exception2 e){
//处理Exception2的代码块
}..(n个catch块)..{
}finally{
//最终将要执行的代码
}
注意:顺序问题-按照从小到大,先子类后父类的顺序
e.g:InputMismatchException -> ArithmeticException -> Exception
2015-09-01
最赞回答 / needself
全局变量Student student建立以后,creatStudentAndSelectCourse方法里的sd都要改为student,就解决了。
2015-08-29