Java 7 underscore in numeric literals
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: When we must use a _ to separate digits in a number I don't' understand the following case in which I can't use it: In positions where a string of digits is expected (as documented in the JDK7 guide here ) Some examples? 回答1: You don't have to use "_", you can . And examples given in the proposal are credit card numbers, phone numbers, or simply numbers for which it makes sense to have a separator in the code. For the "In positions where a string of digits is expected" it's simply in places where it's supposed to start (or end) with a digit.