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)*/
添加回答
举报
0/150
提交
取消