//Sample15_06.java class Sample15_06{ public static void main(String[] args){ System.out.println("--int--"); int int_dec = 28; int int_bin = 0b11100; int int_oct = 034; int int_hex = 0x1C; System.out.println("28 = " + int_dec); System.out.println("0b11100 = " + int_bin); System.out.println("034 = " + int_oct); System.out.println("0x1C = " + int_hex); System.out.println(""); System.out.println("--double--"); double dou_xx = 3.14; double dou_xxd = 3.14d; System.out.println("3.14 = " + dou_xx); System.out.println("3.14d = " + dou_xxd); System.out.println(""); System.out.println("--char--"); char ch_A = 'A'; char ch_dec = (char)65; char ch_hex = (char)0x41; char ch_uni = '\u0041'; System.out.println("\'A\' = " + ch_A); System.out.println("(char)65 = " + ch_dec); System.out.println("(char)0x41 = " + ch_hex); System.out.println("'\\u0041' = " + ch_uni); System.out.println(""); System.out.println("--boolean--"); boolean bool_y = true; boolean bool_n = false; System.out.println("true = " + bool_y); System.out.println("false = " + bool_n); System.out.println(""); System.out.println("--String--"); String str = "なのです!"; System.out.println("\"なのです!\" = " + str); } }
>javac Sample15_06.java >java Sample15_06 --int-- 28 = 28 0b11100 = 28 034 = 28 0x1C = 28 --double-- 3.14 = 3.14 3.14d = 3.14 --char-- 'A' = A (char)65 = A (char)0x41 = A '\u0041' = A --boolean-- true = true false = false --String-- "なのです!" = なのです!