s1 = "I love you!!!";不是double型,所以d1=Double.parseDouble(s1);出现NumberFormatException异常。finally最后都会执行System.out.println("i love you!!!");
。所以输出i love you!!!你泡MM啊,程序真e

解决方案 »

  1.   

    看一下Class Double 的 parseDouble(String str) 就明白了;    /**
         * Returns a new <code>double</code> initialized to the value
         * represented by the specified <code>String</code>, as performed
         * by the <code>valueOf</code> method of class
         * <code>Double</code>.
         *
         * @param      s   the string to be parsed.
         * @return the <code>double</code> value represented by the string
         *         argument.
         * @exception NumberFormatException if the string does not contain
         *            a parsable <code>double</code>.
         * @see        java.lang.Double#valueOf(String)
         * @since 1.2
         */
        public static double parseDouble(String s) throws NumberFormatException {
    return FloatingDecimal.readJavaFormatString(s).doubleValue();
        }