How to print double without the decimal places in Java

1 Answer

0 votes
class Main {
    public static void main(String[] args) {
        double d = 28374092.401;
        
        System.out.format("%.0f\n", d); 
        System.out.println(String.format("%.0f", d)); 
    }
}


/*
run:

28374092
28374092
 
*/

 



answered Nov 12, 2024 by avibootz

Related questions

1 answer 182 views
1 answer 183 views
1 answer 210 views
1 answer 245 views
1 answer 263 views
1 answer 248 views
2 answers 408 views
...