如何在两个输出之间添加空格? [英] How can I add a space in between two outputs?

查看:595
本文介绍了如何在两个输出之间添加空格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我正在使用的代码。

This is the code I am working with.

public void displayCustomerInfo() {
    System.out.println(Name + Income);
}

我在此代码中使用单独的main方法来调用上面的方法: / p>

I use a separate main method with this code to call the method above:

first.displayCustomerInfo();
second.displayCustomerInfo();
third.displayCustomerInfo();

有没有办法在输出之间轻松添加空格?这就是它目前的样子:

Is there a way to easily add spaces between the outputs? This is what it currently looks like:

Jaden100000.0
Angela70000.0
Bob10000.0


推荐答案

添加文字空间或标签:

public void displayCustomerInfo() {
    System.out.println(Name + " " + Income);

    // or a tab
    System.out.println(Name + "\t" + Income);
}

这篇关于如何在两个输出之间添加空格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆