/**
*
*/
package java151229;
/**
* @author lizheng
*
*/
public class ExceptionTest {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
// Rec rec;
// try {
// rec = new Rec(-3,4);
// rec.getArea();
// } catch (NoValueException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// System.out.println(e.toString());
// }
// Rec rec =new Rec(-3, 4);
// rec.getArea();
// System.out.println("over1");
Circle circle=new Circle(-4);
circle.getArea();
System.out.println("over1");
}
}
/**
* 异常:异常是什么?是对问题的描述.将问题进行对象的封装
* 异常体系:
* throwable
* -error
* -exception
* -runtimeexception
* 异常体系的特点:异常体系hz中的所有类以及建立的对象都举杯kepaoxing
* 也就是说被throw throws关键字所操作
* 至哟异常体系巨臂主个特点
* throe和throws的特点
* throw定义在函数,用于抛出异常对象
* throws定义在函数上,用于抛出异常类,可以抛出多个,用都好隔开
* 润体么exception除外
*/
*
*/
package java151229;
/**
* @author lizheng
*
*/
public class ExceptionTest {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
// Rec rec;
// try {
// rec = new Rec(-3,4);
// rec.getArea();
// } catch (NoValueException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// System.out.println(e.toString());
// }
// Rec rec =new Rec(-3, 4);
// rec.getArea();
// System.out.println("over1");
Circle circle=new Circle(-4);
circle.getArea();
System.out.println("over1");
}
}
/**
* 异常:异常是什么?是对问题的描述.将问题进行对象的封装
* 异常体系:
* throwable
* -error
* -exception
* -runtimeexception
* 异常体系的特点:异常体系hz中的所有类以及建立的对象都举杯kepaoxing
* 也就是说被throw throws关键字所操作
* 至哟异常体系巨臂主个特点
* throe和throws的特点
* throw定义在函数,用于抛出异常对象
* throws定义在函数上,用于抛出异常类,可以抛出多个,用都好隔开
* 润体么exception除外
*/