这是我的代码的开头,我希望用户能够在同一行输入数字,然后分别转移到x
variablesy
和z
。相反,我目前在按回车后逐行读取它。
public static void main (String[]args)
{
Scanner userInput = new Scanner(System.in);
int x = 0;
int y = 1;
int z = 2;
System.out.println("Enter the sides of the triangle: ");
x = userInput.nextInt();
y = userInput.nextInt();
z = userInput.nextInt();
Triangle isos = new Triangle(x,y,z);
Triangle equal = new Triangle(x,y,z);
Triangle scalene = new Triangle(x,y,z);
}