java2從頭開學(12)
package 數據類型;//類型提升約定
class Promote {
?public static void main(String args[]){
??byte b = 42;
??char c = 'a';
??short s = 1024;
??int i = 50000;
??float f = 5.67f;
??double d = .1234;
??double result = (f * b) + (i / c) - (d * s);
??System.out.println((f * b) + " + " + (i / c) + " - " + (d * s));
??System.out.println("result = " + result);
?}
}
posted on 2008-04-11 14:35 dripstone 閱讀(216) 評論(0) 編輯 收藏 所屬分類: java2學習