public static void area(){
Scanner s = new Scanner(System.in);
final float PI = (float) 3.1415926;
float area;
int r = 0;
System.out.println("请输入半径:");
while(r <= 0){
try{
TestException(r = s.nextInt());
area = PI * r * r;
System.out.println("圆的面积为:" + area);
}
catch (Exception ex) {
System.out.print("输入错误,请再次输入:\n");
}
}
}
public static void TestException(int i) throws Exception{
if(i <= 0){
throw new Exception("小于等于零");
}
}
TestException方法是什么意思?