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 100 views
1 answer 101 views
1 answer 118 views
1 answer 152 views
1 answer 174 views
1 answer 159 views
2 answers 288 views
...