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 保爾任 閱讀(327) 評論(0)  編輯  收藏

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


          網站導航:
           

          <2025年5月>
          27282930123
          45678910
          11121314151617
          18192021222324
          25262728293031
          1234567

          常用鏈接

          留言簿(4)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 中牟县| 玉田县| 古田县| 平阳县| 九龙城区| 尚义县| 新郑市| 乌兰浩特市| 天镇县| 颍上县| 虎林市| 巴林右旗| 泰宁县| 朔州市| 西吉县| 峨眉山市| 永安市| 云林县| 泰州市| 临江市| 赤水市| 文化| 梁山县| 凤冈县| 大化| 北京市| 木兰县| 东阿县| 长寿区| 青河县| 泰州市| 平度市| 方城县| 玉溪市| 天峨县| 夹江县| 灵山县| 西昌市| 武鸣县| 崇义县| 昔阳县|