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 93 views
1 answer 93 views
1 answer 104 views
1 answer 143 views
1 answer 167 views
1 answer 153 views
2 answers 275 views
...