| 发表于:2007-01-29 18:29:13 楼主 |
/public class exceptiondemo { / static int caculate(int a,int b){ / int c=a/b; / return c; / } / public static void main(string args[]){ / try{ / //静态方法最好用类名调用. / int c=exceptiondemo.caculate(9,0); / system.out.println(c); / } / catch(exception e){ / system.err.println( "异常: "+e.tostring()); / e.printstacktrace(); / } / } /} |
|
|
|
|