/*
*/
public class TestException
{
public static void main(String [] args)
{
try
{
int result=new Test().devide(3,0);
System.out.println("the result is :" +result);
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
System.out.println("program is running here ,that is normal !");
}
}
class Test
{
public int devide(int x,int y)
{
return x/y;
}
}
编译错误提示如下: 求解决
Yichang.java:3: 错误: 类TestException是公共的, 应在名为 TestException.java 的文
件中声明
public class TestException
^
1 个错误
|
|