Answers for "print many variables in one line in java"

1

how to print two variables in same line in java

// Let var1 be the first variable and var2 the second
System.out.print(var1 + " " + var2); // does not advance to next line

// Or alternatively
System.out.println(var1 + " " + var2); // prints and then advances to next line
Posted by: Guest on January-24-2022
1

how to print multiple lines in java

System.out.println("Players take turns marking a square."
+ "\nOnly squares not already marked can be picked."
+ "\nOnce a player has marked three squares in a row, he or she wins!"
+ "\nIf all squares are marked and no three squares are the same, a tied game is declared."
+ "\nHave Fun!");
Posted by: Guest on September-02-2021

Code answers related to "print many variables in one line in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language