Java 如何让我的System.out.prints在彼此下面对齐?

Java 如何让我的System.out.prints在彼此下面对齐?,java,Java,我希望所有的回答都排成一行 例如: x=y y=x 等等 不是 x=y y=x ect // Julian Vizcarra // Lab 05 question 2 public class Lab05_02 { public static void main(String[] args) { java.util.Scanner input = new java.util.Scanner(System.in); // Enter an integer System.out.print("Ent

我希望所有的回答都排成一行

例如:

x=y

y=x

等等

不是

x=y y=x ect

// Julian Vizcarra
// Lab 05 question 2
public class Lab05_02 {
public static void main(String[] args) {
java.util.Scanner input = new java.util.Scanner(System.in);
// Enter an integer
System.out.print("Enter an integer: ");
int number = input.nextInt();

//compute math
int ok = number/5;
int ok2= number/6;

//If statement
if (number % 5 == 0 && number % 6 == 0){
 System.out.print("Is " + number + " divisible by 5 and 6?" + " True "  );}  

    else {System.out.print("Is " + number + " divisible by 5 and 6?" + " False "  );  }

if (number % 5 == 0 || number % 6 == 0) {
 System.out.print("Is " + number + " divisible by 5 or 6?" + " True "  );}

    else {System.out.print("Is " + number + " divisible by 5 or 6?" + " False "  );}

if (number % 5 == 0 ^ number % 6 == 0) {
System.out.print("Is " + number + " divisible by 5 or 6, but not both" + " True");}

    else {System.out.print("Is " + number + " divisible by 5 or 6, but not both" + " False");}
}
}
我的输出是:

输入一个整数:60


60可以被5和6整除吗?真的是60可以被5或6整除吗?True是60,可以被5或6整除,但不能同时为False和False使用,而不是System.out.print()

尝试使用println()代替答案中可能重复的打字,你的第二个答案应该是“print”而不是“println”:System.out.println(“值”)或System.out.print(“值\n”)