小编use*_*619的帖子

在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 …
Run Code Online (Sandbox Code Playgroud)

java string formatting printf println

3
推荐指数
1
解决办法
93
查看次数

标签 统计

formatting ×1

java ×1

printf ×1

println ×1

string ×1