Formatting number with underscore

I tried to format a long number with underscore, but the number didn’t get formatted with commas. I am using sdk 16 ,intelliJ as my editor and windows OS.

Please show your code and your output, then it will be easier for someone to help.

1 Like

Updating with screen print of the code…

image|690x282

You can use the underscore to format constant values in your code for readability. It’s a substitute because you can’t use a comma since that is already used as a separator in Java.

To format values in your program output you can use String.format() or NumberFormat which are covered later in the course.

Oh okay! I get it now…so stupid of me😂