【问题标题】:I want to print tab space in java. println("\t") doesn't work [closed]我想在 java 中打印制表符空间。 println("\t") 不起作用[关闭]
【发布时间】:2020-08-30 05:27:45
【问题描述】:

我正在学习 java 课程,而我的老师是这样做的 System.out.println("A\tB\tC\tD\tE\tF"); 看 A B C D E F 但正如你在我的截图中看到的那样,它不起作用..!!! 我该如何解决这个问题。请帮助我

【问题讨论】:

  • 这可能是由 Console 视图中使用的字体引起的视觉问题(非 ASCII 字符比 ASCII 字符宽,尽管它是等宽字体)。 System.out.println("A\tB\tC\tD\tE\tF") 有效吗?
  • @howlger "A\t\B\tC..." 也没有用,但你给了我一个很大的提示。是因为字体!我设置了“Source Code Pro”字体,这是控制台中间距选项卡的问题。我更改了字体并解决了问题。非常感谢。这是一个很大的帮助。

标签: java string eclipse printing


【解决方案1】:
you can give tab space in java easily. "\t" is the space sequence in java programming. Below i have given some examples:

Example 1:

System.out.print("生日快乐");

The output:

Happy Birthday

Example 2:

System.out.print("java\tprogramming");

The output:

Java programming.

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-05-05
    • 1970-01-01
    • 1970-01-01
    • 2018-04-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多