In Java SE 7 and later, any number of underscore characters (
_) can appear anywhere between digits in a numerical literal. It can improve the readability of your code.
we can place underscores only between digits
we cannot place underscores in the following places:
- At the beginning or end of a number (_54 , 54_)
- Adjacent to a decimal point in a floating point literal (1._22)
- Prior to an
- In positions where a string of digits is expected