cxy19822003
发贴: 8
积分: 0
|
于 2005-01-17 19:56
class Hello{ static String s=new String("10.22d"); public static void main(String[] args){ try{ System.out.println(Float.parseFloat); } catch(Exception e){ System.out.println(e.toString()+"\n"+e.getMessage()); } } } 上面这个程序它编译和运行都不会有错 再看下面一个,我把10.22d改成10.22q class Hello{ static String s=new String("10.22d"); public static void main(String[] args){ try{ System.out.println(Float.parseFloat); } catch(Exception e){ System.out.println(e.toString()+"\n"+e.getMessage()); } } } 编译可以,运行出现如下错误
|