From Java 7, you can have underscores between numbers to improve readability:
From JLS - Section 3.10.1 and JLS Section 3.10.2 :
Underscores are permitted as delimiters between numbers that represent an integer.
For a floating point literal also:
Underscores are permitted as delimiters between digits that indicate part of an integer, and between digits that indicate part of a fraction, and between digits that indicate exponent.
For example, 1000000000 can now be written as 1_000_000_000 . So, better for the eyes, isn't it.
Similarly, you can write - 0x7fff_ffff , 0b0111_1111 .
And regarding the variable name, _ is a valid variable name. According to the Java standard, the variable name must begin with $ , _ or letter .
source share