Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/382.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 代码打印hello world尽管是数学_Java_Math - Fatal编程技术网

Java 代码打印hello world尽管是数学

Java 代码打印hello world尽管是数学,java,math,Java,Math,我在repl.it上试这个,它只是。。。默认情况下打印hello world。我不知道我到底做错了什么 导入java.util.Scanner; 类输入{ 公共静态字符串[]参数{ 扫描仪输入=新的ScannerSystem.in; System.out.print输入您的第一个双精度:; double firstDouble=input.nextDouble; System.out.Print您输入的第一个数字是+firstDouble+。; System.out.print输入第二个doub

我在repl.it上试这个,它只是。。。默认情况下打印hello world。我不知道我到底做错了什么

导入java.util.Scanner; 类输入{ 公共静态字符串[]参数{ 扫描仪输入=新的ScannerSystem.in; System.out.print输入您的第一个双精度:; double firstDouble=input.nextDouble; System.out.Print您输入的第一个数字是+firstDouble+。; System.out.print输入第二个double:; double secondDouble=input.nextDouble; System.out.print您输入+secondDouble+作为第二个数字。; System.out.print输入第三个双精度:; double thirdDouble=input.nextDouble; System.out.print您输入+thirdDouble+作为第三个数字。; 输入。关闭; } } 看起来你的主要方法是“面”

除此之外,如果没有更改第一个文件的默认名称,则应将类命名为Main或repl。它将不会编译

import java.util.*;
class Main {
  public static void main(String[] args) {
   Scanner input = new Scanner(System.in);

System.out.print("Enter your first double: ");
double firstDouble = input.nextDouble();
System.out.print("You entered " + firstDouble + " as your first number.");

System.out.print("Enter you second double: ");
double secondDouble = input.nextDouble();
System.out.print("You entered " + secondDouble + " as you second number.");

System.out.print("Enter your third double: ");
double thirdDouble = input.nextDouble();
System.out.print("You entered " + thirdDouble + "As your third number.");

input.close();
  }
}
试试这段代码,因为repl编译的程序名为Main.java,而您的程序名为Input.java,所以您得到的是hello world