提问代码如下:public class Exceptionx
{
public static void main(String[] args) throws IException
{
int a=10;
int b=0;
//IExecption e=new IExecption();
int c;
try{ c=a/b;
}
catch (IException e)
{
System.out.println("oo");
}
}}
class IException extends Exception
{
public static void main(String[] args)
{
}
public void IException()
{
System.out.println("ok");
}
};
{
public static void main(String[] args) throws IException
{
int a=10;
int b=0;
//IExecption e=new IExecption();
int c;
try{ c=a/b;
}
catch (IException e)
{
System.out.println("oo");
}
}}
class IException extends Exception
{
public static void main(String[] args)
{
}
public void IException()
{
System.out.println("ok");
}
};
解决方案 »
- Java代码 ,有点困惑不解
- JTable表格中总是显示不出数据,大哥大姐帮帮忙啊~
- 怎样 在 下次 编译 程序时 不用输入 路径名啊!!
- 为什么paintComponent(Graphics g)不能立即得到Image.getWidth()的值
- 请大家看看我的监听端口的代码,问什么所有的断口都抛出IOException异常呢?
- 数据类型相互转换的问题!
- 给树添加监听器,帮我看看错在哪里
- 请教一个Java代码的错误的调试解决方法
- Java中List转换为数组,数组转List
- weblogic 6 下载?
- 请问如何将jtextfield里的内容转换为数字,存放在double类型里?
- 各位前辈给点面试的经验吧,发言有分
Exceptionx.java:12: exception IException is never thrown in body of correspondin
g try statement
catch (IException e)
^
1 error
public static void main(String[] args)
throws IException {
int a = 10;
int b = 0;
IException e = new IException();
int c;
try {
c = a / b;
} catch (Exception ie) {
throw e;
}
}}class IException extends Exception {
public static void main(String[] args) {
} public IException() {
System.out.println("ok");
}}