數字之間的轉換
(byte,short,char)--int--long--float—double
低級到高級, 自動轉換
但是如果是要降低精度的轉換,要加強制轉換的標記
double a;
int b = (int) a;// a 的小數部分會被完全省略
基本類型轉換到String
用包裝類:Int, Long。。。 ,然後調用toString()方法,包裝類還有***Value()方法
和空字符串連接:“” + number
(byte,short,char)--int--long--float—double
低級到高級, 自動轉換
但是如果是要降低精度的轉換,要加強制轉換的標記
double a;
int b = (int) a;// a 的小數部分會被完全省略
用包裝類:Int, Long。。。 ,然後調用toString()方法,包裝類還有***Value()方法
和空字符串連接:“” + number
一. 二. 三. ! 作 者 : Yaopengfei(姚鵬飛) 博客地址 : http://www.cnblogs.com