简体   繁体   English

我正在使用eclipse并收到此错误,有人可以告诉我我要去哪里了

[英]I am using eclipse and getting this error can someone tell me where I am going wrong

import java.util.Scanner;
package reviewDistance;

public class ReviewDistance {

    public static void main(String[] args) {
        int sec1;
        int sec2;
        int sec3;
        int race;
        Scanner input = new Scanner(System.in);

        System.out.print("Enter the length of the first section of the race in kilometers:");
        sec1 = input.nextInt();
        System.out.print("Enter the length of the second section of the race in kilometers:");
        sec2 = input.nextInt();
        System.out.print("Enter the length of the third section of the race in kilometers:");;
        sec3 = input.nextInt();
        input.close();

        race = sec1 + sec2 + sec3;
        System.out.println("Length of the race: " + race + "km");

    }

}

The error code I recieve is this and I don't know why! 我收到的错误代码是这个,我不知道为什么! I am very new to Java 我是Java的新手

Exception in thread "main" java.lang.Error: Unresolved compilation problem: 线程“主”中的异常java.lang.Error:未解决的编译问题:

at reviewDistance.ReviewDistance.main(ReviewDistance.java:6)
import java.util.Scanner;
package reviewDistance;

change it to 更改为

package reviewDistance;
import java.util.Scanner;

package should be the first line in your jave file 包应该是您的jave文件的第一行

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 谁能告诉我在这种情况下我哪里错了? - Can anyone tell me where i am wrong in this condition? 谁能告诉我代码中的错误或我在哪里出错? - Can anybody tell what error or where am i going wrong in code? 来自孩子 class 的测试用例没有运行,遇到错误谁能指导我哪里出错了 - Test cases from child class is not running, facing error can anyone please guide me where I am going wrong 这是简单的抽象演示代码,我无法创建suresh类的对象,有人可以帮助我解决这里发生的问题 - This is simple Abstraction demo code where i am not able to create a object of suresh class can someone help me out what is going wrong here 谁能告诉我以下程序做错了什么? 我收到类似的错误<identifier expected>和“&#39;;预期” - Can anybody tell me what am i doing wrong with the following program? I am getting errors like <identifier expected> and " '; expected" type 语句中的方法 executeQuery(string) 不适用于 arguments (),我哪里出错了? 使用 Eclipse - method executeQuery(string) in the type statement is not applicable for the arguments (), Where am I going wrong? Using Eclipse 有一种有效的“合并排序”功能,但不是完全可以,有人可以告诉我我做错了什么吗? - Have a sort of working Merge Sort, but not quite, could someone tell me what I am doing wrong? 这个菜单我哪里出错了 - Where am I going wrong with this menu Java程序:哪里出问题了? - Java Program: Where am I going wrong? 我在 intellij 上运行 springboot 应用程序时出错。 有人能帮我吗? - I am getting an error running a springboot application on intellij. Can someone help me?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM