程序问答   发布时间:2022-06-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Java - 输出行大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决Java - 输出行?

开发过程中遇到Java - 输出行的问题如何解决?下面主要结合日常开发的经验,给出你关于Java - 输出行的解决方法建议,希望对你解决Java - 输出行有所启发或帮助;

我想知道是否有办法在运行后在输出中创建一行,

代码是

int topscore = 80;
        if (topscore < 100) {
            System.out.println("You got the high score!");
        }
        int secondtopscore = 60;
        if (topscore > secondtopscore && topscore < 100) {
            System.out.println("Greater than second top score and less than 100");
        }

        //VIDeo 36 - Logical OR Operator

        int topscore1 = 80;
        if (topscore1 < 100) {
            System.out.println("You got the high score!");
        }
        int secondtopscore1 = 81;
        if ((topscore1 > secondtopscore1) && (topscore1 < 100)) {
            System.out.println("Greater than second top score and less than 100");
        }

输出是

   You got the high score!
   Greater than second top score and less than 100
   You got the high score!

但是我希望它有一个空格链接这个

You got the high score!
Greater than second top score and less than 100
**Blank line
You got the high score!

我尝试过\n但似乎不起作用

解决方法

你可以在字符串的开头加上\n

  int topScore = 80;
    if (topScore < 100) {
        System.out.println("\nYou got the high score!");
    }
    int secondTopScore = 60;
    if (topScore > secondTopScore && topScore < 100) {
        System.out.println("Greater than second top score and less than 100");
    }

    //Video 36 - Logical OR Operator

    int topScore1 = 80;
    if (topScore1 < 100) {
        System.out.println("\nYou got the high score!");
    }
    int secondTopScore1 = 81;
    if ((topScore1 > secondTopScore1) && (topScore1 < 100)) {
        System.out.println("Greater than second top score and less than 100");
    }
,

只使用不带参数的 println

System.out.println() 

大佬总结

以上是大佬教程为你收集整理的Java - 输出行全部内容,希望文章能够帮你解决Java - 输出行所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:-Java