编程语言
首页 > 编程语言> > java通过下划线数字字面量增加可读性:10_00_00表示100000

java通过下划线数字字面量增加可读性:10_00_00表示100000

作者:互联网

用法

    int x1  = 2_014;     // Underscore in  deciaml format
int x2  = 2___014;   // Multiple consecutive underscores 
int x3  = 02_014;    // Underscore in  octal literal
int x4  = 0b0111_1011_0001;  // Underscore in binary literal
int x5  = 0x7_B_1;           // Underscores in hexadecimal literal 
byte b1 = 1_2_7;             // Underscores in decimal format 
double d1 = 2_014.01_11;     // Underscores in double literal

https://blog.csdn.net/qq_27789551/article/details/52014372
https://docs.oracle.com/javase/7/docs/technotes/guides/language/underscores-literals.html

标签:10,00,java,int,Underscores,literal,014,Underscore
来源: https://www.cnblogs.com/shengulong/p/11746120.html