我已经在Windows 10中安装了最新版本的稳定VS Code构建,并且RedHat支持Java语言。我使用的是jdk1.8.0_181。
System.out.print()
和System.out.println()
在调试控制台中产生预期的输出,而System.out.format()
和System.out.printf()
在意外位置分割行并且也不一致地处理%n
。以下面的代码片段为例:
import java.util.stream.IntStream;
public class PrintfTest {
public static void main(String[] args) {
IntStream.range(0, 100).forEach(it ->
System.out.format("This is iteration %d. Hello VS Code! Hello RedHat!%n", it));
}
}
尝试运行它。我的输出看起来像这样:
This is iteration
0. Hello VS Code! Hello RedHat!
This is iteration 1. Hello VS Code! Hello RedHat!
This is iteration 2. Hello VS Code! Hello RedHat!
This is iteration 3. Hello VS Code! Hello RedHat!
This is iteration 4. Hello VS Code! Hello RedHat!
This is iteration 5. Hello VS Code! Hello RedHat!
This is iteration
6. Hello VS Code! Hello RedHat!
This is iteration
7
. Hello VS Code! Hello RedHat!
This is iteration
8. Hello VS Code! Hello RedHat!
This is iteration
9. Hello VS Code! Hello RedHat!
This is iteration...
我的意思是,它是一种基本功能,肯定有些明显的东西我很想念。