| int x = 3; System.out.print(Math.pow(x, 3)); |
Error |
| int x = 3; System.out.print(Math.pow((double)x, 3)); |
27 |
| 算術變數 | 轉換方法 | ⇔ | 轉換方法 | 字串 | |
| 類型 | 變數型態 | ||||
| 整數 | byte | Byte.toString(byte); | ⇔ | Byte.parseByte(String); | String |
| short | Short.toString(short); | Short.parseShort(String); | |||
| int | Integer.toString(int); | Integer.parseInt(String); | |||
| long | Long.toString(long); | Long.parseLong(String); | |||
| 浮點數 | float | Float.toString(float); | Float.parseFloat0(String); | ||
| double | Double.toString(double); | Double.parseDouble(String); |