java2从头开学(12)

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);
 }
}

你可能感兴趣的:(java2从头开学(12))