我正在尝试修复我编写的脚本:
import java.util.Scanner;
public class Line2
{
public static void main (String [] args)
{
Scanner scan = new Scanner (System.in);
System.out.println ("Please enter 4 integers");
int x1 = scan.nextInt();
int y1 = scan.nextInt();
int x2 = scan.nextInt ();
int y2 = scan.nextInt ();
double distance;
//Asking the user to insert coordinates of both points and setting double
// on distance in order to properly calculate the square root
distance = Math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
System.out.print( "the length of the line between the points" (int x1, int x2) "and" (int y1, int y2) "is" distance);
//Telling the program to calculate the distance of two points given by user
}//end of method main
}
我正在尝试制作x1
x2
y1
并y2
出现在里面,但是它不允许我 - 给出 Y(有点)预期......我该怎么做才能让它出现,不管它int
是什么?(除了程序运行得很好,我认为..)谢谢