我想在Java中打印制表符。println(“\t”)无法正常工作。

huangapple go评论82阅读模式
英文:

I want to print tab space in java. println("\t") doesn't work

问题

我想在Java中打印制表符。println(“\t”)无法正常工作。

我正在上一门Java课程,我的老师做了这个操作
System.out.println("A\tB\tC\tD\tE\tF");
来显示 A B C D E F
但正如您在我的截图中看到的,它不起作用..!!!
我该如何解决这个问题。请帮帮我

英文:

我想在Java中打印制表符。println(“\t”)无法正常工作。

I'm taking a java class rn and my teacher did this
System.out.println("A\tB\tC\tD\tE\tF");
to see A B C D E F
but as you can see in my screenshot, it doesn't work..!!!
how can I solve this. pls help me

答案1

得分: 4

你可以在Java中轻松地使用制表符空格。"\t" 是Java编程中的空格序列。下面我给出了一些例子:

示例1:

System.out.print("Happy\tBirthday");

输出:

Happy Birthday

示例2:

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

输出:

Java programming。

英文:
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("Happy\tBirthday");

The output:

Happy Birthday

Example 2:

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

The output:

Java programming.

huangapple
  • 本文由 发表于 2020年8月30日 13:27:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/63654248.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定