public class ych {
public class r
{
private double radius;
public void g(double r) throws f
{
if(radius<0)
{
throw new f(r);
}
else
{
radius=r;
}
}
}
public class f extends Exception {
double radius;
f(double r)
{
radius=r;
}
public String toString()
{
return "radius"+this.radius+"r";
}
}
public static void main(String[] args) {
r b=new r();
try{
b.g(-2);
}
catch(f e){
System.out.println(""+e.toString()+"");
}
}
}
/*
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
at ych.main(ych.java:32)
*/
慕粉3291149
慕瓜9220888
相关分类