栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

数字文字中的Java 7下划线

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

数字文字中的Java 7下划线

你不具备使用”_”,你可以。提案中提供的示例包括信用卡号,电话号码或仅在代码中使用分隔符的数字。

对于“在期望数字串的位置”,它只是在应该以数字开头(或结束)的地方。这里有些例子。

请注意,根据此建议,下划线只能放在数字之间。不能将它们自己放置在通常期望数字串的位置:

int x1 = _52; // This is an identifier, not a numeric literal.

int x2 = 5_2; // OK. (Decimal literal)

int x2 = 52_; // Illegal. (Underscores must always be between digits)

int x3 = 5_2; // OK. (Decimal literal.)

int x4 = 0_x52; // Illegal. Can’t put underscores in the “0x” radix prefix.

int x5 = 0x_52; // Illegal. (Underscores must always be between digits)

int x6 = 0x5_2; // OK. (Hexadecimal literal)

int x6 = 0x52_; // Illegal. (Underscores must always be between digits)

int x6 = 0x_; // Illegal. (Not valid with the underscore removed)

int x7 = 0_52; // OK. (Octal literal)

int x7 = 05_2; // OK. (Octal literal)

int x8 = 052_; // Illegal. (Underscores must always be between digits)



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/441903.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号