+ 1
1_0==10 ?
System.out.print (1_0==10); // why it is true?
3 Answers
+ 1
Because 1_0 is 10.
Underscore just separates digits so you can read numbers more easily.
x= 1000000 is not so easy to read, x= 1_000_000 now you can easily see that x is one million.
0
It's a type of representation of numbers, used in some scientific notations of numbers..
The compiler just ingore _ in between numbers.. So it is true according to JVM.
Edit: David Yan for more information
See thses.. Saying added feature for improve readability...
https://stackoverflow.com/questions/19806632/how-numeric-literal-with-underscore-works-in-java-and-why-it-was-added-as-part-o
https://www.google.com/amp/s/www.geeksforgeeks.org/g-fact-45-using-underscore-in-numeric-literals/amp/
0
Asked before
https://www.sololearn.com/Discuss/1873019/?ref=app