java類型


public class Example_1 {

	public static void main(String[] args) {
		byte b = 22;
		int n = 129;
		float f =123456.6789f;
		double d = 123456789.123456789;
		System.out.println("b= "+b);
		System.out.println("n= "+n);
		System.out.println("f= "+f);
		System.out.println("d= "+d);
		b = (byte)n;//導致精度的損失
		f = (float)d;//導致精度的損失
		System.out.println("b= "+b);
		System.out.println("f= "+f);
		

	}

}

 

發佈了42 篇原創文章 · 獲贊 9 · 訪問量 1萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章