李翊愷java data type期中考
/*李翊愷2022/10/28w3schools資料型態date type*/
public class Main { public static void main(String[] args) { float f1 = 353; /*宣告實數,浮點數,4 bytes位元組=32bits位元*/ double d1 = 124d; /*宣告倍精術數,8 bytes位元組=64 bits位元*/ byte i1; short i2;/* 位元數,1位元組; 短整數2位元*/ int i, j; /* 整數 ,4 bytes位元組=32bits位元*/ char dragon = '龍'; i = dragon ;/*字元佔2 bytes,i字碼*/ System.out.println("位元數最小" + Byte.MIN_VALUE); System.out.println("位元數最大" + Byte.MAX_VALUE); System.out.println("短整數最小" + Short.MIN_VALUE); System.out.println("短整數最大" + Short.MAX_VALUE); System.out.println( dragon ); System.out.println( i ); } }
//李翊愷2022/10/28w3schools資料型態date type public class Main { public static void main(String[] args) { int i, j; /* 整數 ,4 bytes位元組=32bits位元*/ for ( i = 40800; i < 40900; i = i + 10) { System.out.print("字碼" + i + " : "); for ( j = 0; j < 10; j++) System.out.print( Character.toString( i + j) );/*輸出字元的方法*/ System.out.println(); } System.out.println("癡的字碼是" + Integer.valueOf('癡')); System.out.println("30305的字元是" + Character.toString(30305)); } } /*方法Character.toString 相當於EXCEL的 Unichar 函數,將字碼轉成字元 方法Integer.valueOf 相當於EXCEL的 Unicode 函數,將字元轉成字碼 */
留言
張貼留言