1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| public class Test { public static void main(String[] args) { int intNum = 4; float floatNum = 9.5F; floatNum /= intNum; System.out.println("9.5F/4 = " + floatNum); double numX = 4.88; double numY = 78.83; int numZ = (int)numX + (int)numY; System.out.println("4.88 + 78.83 = " + numZ); char charVar = 'T'; int intVar = (int) charVar; System.out.println("将字符T转换成int型变量是:" + intVar); int num1 = 34; double num2 = (double) num1/3; System.out.println("34的三分之一是:"+num2); } }
|