java print int_java – 在printin输入int
我正在嘗試修復我寫的腳本:
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出現(xiàn)在里面,但它不允許我 – 給Y(有點)預期……
無論int是什么,我能做什么才能使它出現(xiàn)? (除了那個程序運行得很好,我認為..)
謝謝
總結(jié)
以上是生活随笔為你收集整理的java print int_java – 在printin输入int的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java生成pdf表格_java在pdf
- 下一篇: java amqp_AMQP协议