简体   繁体   中英

integers adding instead of printing java

                if(a >= b && a >= c && b >= c) {
                    System.out.println(a + b + c);
                } else if(a >= b && a >= c && c >= b) {
                    System.out.println(a + c + b);
                } else if(b >= a && b >= c && a >= c) {
                    System.out.println(b + c + a);
                } else if(c >= a && c >= b && a >= b) {
                    System.out.println(c + a + b);
                } else if(c >= a && c >= b && b >= a) {
                    System.out.println(c + b + a);
                } else {
                        System.out.println ("Program not working!");
                    }

what do I need to make it just display the integers with one white space between them?

I tried google a bunch of times, but apparently I can't phrase it so that google can give me an answer.

I assume it's something just in the print line but I included my whole statement.

Replace

System.out.println(c + b + a);

by

System.out.println(c + " " + b + " " + a);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM