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 182 views
1 answer 174 views
1 answer 165 views
3 answers 259 views
1 answer 186 views
...