java2從頭開學(8)

          package 數據類型;
          //強制類型轉換
          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)  編輯  收藏


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


          網站導航:
          博客園   IT新聞   Chat2DB   C++博客   博問  
           
          <2008年4月>
          303112345
          6789101112
          13141516171819
          20212223242526
          27282930123
          45678910

          導航

          統計

          常用鏈接

          留言簿(1)

          隨筆分類(1)

          隨筆檔案(16)

          友情鏈接

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 德阳市| 岚皋县| 五台县| 利川市| 南川市| 乐东| 嘉定区| 刚察县| 栖霞市| 翁牛特旗| 科尔| 民权县| 久治县| 彰武县| 贵溪市| 大悟县| 弥勒县| 津市市| 修武县| 宁津县| 淮滨县| 奈曼旗| 军事| 隆安县| 新邵县| 黔东| 自治县| 农安县| 黄平县| 隆安县| 永州市| 湖州市| 门头沟区| 仁化县| 陇南市| 龙门县| 镇雄县| 邯郸市| 开化县| 淮滨县| 荣成市|