long类型的十六进制文字表示为-
long hexLong = 0XABL;
对于十六进制,将0x或0X放在数字的开头。
注-数字10到15用十六进制的a到f(A到F)表示
public class Demo {
public static void main(String []args) {
long hexLong = 0XABL;
System.out.println("Hexadecimal literal of type long: "+hexLong);
}
}输出结果
Hexadecimal literal of type long:171