简体   繁体   English

整数添加而不是打印java

[英]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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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