java2從頭開學(xué)(8)

          package 數(shù)據(jù)類型;
          //強制類型轉(zhuǎn)換
          class Conversion {
          ?public static void main(String args[]){
          ??byte b;
          ??int i = 257;
          ??double d = 323.142;
          ??
          ??System.out.println("\nConversion of int to byte.");
          ??b = (byte) i;
          ??System.out.println("i and b " + i + " " + b);
          ??
          ??System.out.println("\nConversion of double to byte.");
          ??i = (int) d;
          ??System.out.println("d and i " + d + " " + i);
          ??
          ??System.out.println("\nConversion of double to byte.");
          ??b = (byte) d;
          ??System.out.println("d and b " + d + " " + b);
          ?}

          }

          posted on 2008-04-11 14:33 dripstone 閱讀(183) 評論(0)  編輯  收藏


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


          網(wǎng)站導(dǎo)航:
           
          <2008年4月>
          303112345
          6789101112
          13141516171819
          20212223242526
          27282930123
          45678910

          導(dǎo)航

          統(tǒng)計

          常用鏈接

          留言簿(1)

          隨筆分類(1)

          隨筆檔案(16)

          友情鏈接

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 台中市| 平度市| 兴安盟| 英吉沙县| 南城县| 额济纳旗| 天水市| 安福县| 峨眉山市| 富顺县| 宕昌县| 宁河县| 翼城县| 泗阳县| 义乌市| 福清市| 高安市| 乐昌市| 玉环县| 磴口县| 大城县| 丽江市| 荔波县| 昭平县| 响水县| 全南县| 康保县| 桂东县| 斗六市| 孟津县| 嘉黎县| 扎赉特旗| 天等县| 石林| 龙泉市| 蕉岭县| 鹤庆县| 安西县| 邯郸县| 凤山市| 察雅县|