How to set value with underscores to an integer in Java

1 Answer

0 votes
public class MyClass {
    public static void main(String args[]) {
        int x = 123_45_6;

        System.out.println(x);
    }
}



/*
run:

123456

*/

 



answered May 26, 2019 by avibootz

Related questions

2 answers 287 views
1 answer 259 views
1 answer 253 views
3 answers 376 views
1 answer 258 views
...