我有以下信息:
System.out.println("Players take turns marking a square. Only squares not already marked can be picked. Once a player has marked three squares in a row, he or she wins! If all squares are marked and no three squares are the same, a tied game is declared. Have Fun!");
这是一条很长的消息,在我的屏幕上有条纹,我想把它分成几段,这样它就不会破坏我代码的设计流程。但是,当我按下回车键时,Java 不再将该行解释为字符串; Java认为它是一个单独的声明。如何让 Java 解释多行打印语句?
最佳答案
您正在寻找这样的东西吗?
String line = "Information and stuff" +
"More information and stuff " +
"Even more information and stuff";
System.out.println(line);
关于Java:使 System.out.println() 参数跨越多行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27408889/