posts - 73,  comments - 55,  trackbacks - 0

          數字類型轉換成字符串型:
          String s = String.valueOf(value);?

          數字對象轉換成字符串型
          Long l = new Long(10);
          String s = l.toString();

          數字類型/字符串轉換成數字對象:
          byte b = 169;
          String b = "169";
          Byte bo = new Byte( b );

          short t = 169;
          String b = "169";
          Short to = new Short( t );

          int i = 169;
          String b = "169";
          Integer io = new Integer( i );

          long l = 169;
          String b = "169";
          Long lo = new Long( l );

          float f = 169f;
          String b = "169";
          Float fo = new Float( f );

          double d = 169f;
          String b = "169";
          Double dObj = new Double( d );?

          字符串型轉換成各種數字類型:
          String s = "169";
          byte b = Byte.parseByte( s );
          short t = Short.parseShort( s );
          int i = Integer.parseInt( s );
          long l = Long.parseLong( s );
          float f = Float.parseFloat( s );
          double d = Double.parseDouble( s );

          數字對象轉換成數字類型:(*o為一數字對象)
          b = bo.byteValue();
          t = to.shortValue();
          i = io.intValue();
          l = lo.longValue();
          f = fo.floatValue();
          d = dObj.doubleValue();

          posted on 2006-06-01 14:37 保爾任 閱讀(329) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           

          <2025年7月>
          293012345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

          常用鏈接

          留言簿(4)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 大丰市| 洛宁县| 罗平县| 武隆县| 青海省| 台北县| 德庆县| 彩票| 习水县| 南澳县| 永州市| 高雄县| 隆子县| 扬州市| 右玉县| 渝北区| 荥经县| 色达县| 隆子县| 高唐县| 微山县| 桃源县| 石城县| 丰原市| 韶山市| 九江县| 潼关县| 钦州市| 邢台县| 绥江县| 新丰县| 丁青县| 兴国县| 会泽县| 天水市| 太和县| 色达县| 镇沅| 咸宁市| 中卫市| 喀喇沁旗|