220分,解決就全部送出!麻煩看看這個return問題...謝謝. switch( nFmt )其中, switch(case) must be a final type of int , byte, char, short!!!!case 必须为最终变量 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public static final int x= 1 ;我寫了,上面的只是一部分而已,免得各位看倌嫌太長.謝謝. 把 return round(double dfValue , int nFmt,int scale);改为 round(double dfValue , int nFmt,int scale) ;应该就ok了 错了 是这样改成 strResult=round(double dfValue , int nFmt,int scale) ; strResult=round(double dfValue , int nFmt,int scale) ;不過它是返回三個功能中的其中一個功能計算結果,不一定是round處理的結果. public static double round(double dfValue , int nFmt,int scale){ dfValue;scale;//這裏只用這兩個.nFmt不用.scale為取小數點後幾位. return; } 这里面声明了返回类型是double但是你好像没有按要求返回哦 声明的时候public static String formatDouble( double dfValue , int nFmt ) 是返回值是String型,这里又return round(double dfValue , int nFmt,int scale);return的是 double型,不错就怪!加上int scale这个参数前面没有提到阿,什么东西?应该这样改public static double formatDouble( double dfValue , int nFmt ) ^这里把String改成doublereturn round( dfValue , nFmt, scale); ^去掉double ^去掉int ^去掉int return round(double dfValue , int nFmt,int scale);改成return round(dfValue,nFmt,scale);调用方法还把参数类型写在上面,真受不了! public static double round(double dfValue , int nFmt,int scale){ ...}返回的是double 而public static String formatDouble( double dfValue , int nFmt ){...}返回的是String 你把在nFmt =1是返回double 当然Exception 转换类型return String.valueOf(round(....)); 而且正如Mohooo(双之灵)所说,声明了要返回double的,结果直接就return了,后面的double数据哪去了? 问题一大堆:1.就算把return round(double dfValue , int nFmt,int scale);改成return round(dfValue,nFmt,scale);scale的值从哪来的?也没声明过这个变量!2.如tigwin(阿黎)所说,round(dfValue,nFmt,scale);返回的是double,却放在需要String的地方!3.return round(double dfValue , int nFmt,int scale); break; 后面这个break永远不会执行,必须删除!4.return strResult ;这个strResult只是被声明了,还没有初值,怎么return一个值?! 学过C语言 c++,学java看什么书好? eclipse和myeclipse用着很卡,是否有必要升级硬件? synchronized对常量进行加锁 请教java.util.Random类的用法,谢谢 用注释的代码就出错?原理不是一样的么? 哪里可以下载ant 求助:Java发送Mail需要的所有类库和信息 如何选择环境 可以使用vb编写的*.dll吗 ConnectionPool的简单问题 请问如何获取到当前方法名称?马上给分! 问两个UI的基础性问题,顺便散分,帮顶有分
我寫了,上面的只是一部分而已,免得各位看倌嫌太長.謝謝.
改为 round(double dfValue , int nFmt,int scale) ;
应该就ok了
改成 strResult=round(double dfValue , int nFmt,int scale) ;
不過它是返回三個功能中的其中一個功能計算結果,不一定是round處理的結果.
dfValue;scale;//這裏只用這兩個.nFmt不用.scale為取小數點後幾位.
return;
} 这里面声明了返回类型是double
但是你好像没有按要求返回哦
^这里把String改成doublereturn round( dfValue , nFmt, scale);
^去掉double ^去掉int ^去掉int
改成
return round(dfValue,nFmt,scale);调用方法还把参数类型写在上面,真受不了!
返回的是double
而public static String formatDouble( double dfValue , int nFmt ){...}
返回的是String
你把在nFmt =1是返回double 当然Exception
转换类型
return String.valueOf(round(....));
1.就算把return round(double dfValue , int nFmt,int scale);
改成
return round(dfValue,nFmt,scale);
scale的值从哪来的?也没声明过这个变量!
2.如tigwin(阿黎)所说,round(dfValue,nFmt,scale);返回的是double,却放在需要String的地方!
3.return round(double dfValue , int nFmt,int scale);
break;
后面这个break永远不会执行,必须删除!
4.return strResult ;这个strResult只是被声明了,还没有初值,怎么return一个值?!