简体   繁体   English

生成项目错误:找不到符号

[英]Build project error: cannot find symbol

I am getting these two errors. 我收到了这两个错误。 Error: Could not find or load main class Dice Build project error: cannot find symbol 错误:无法找到或加载主类Dice Build项目错误:找不到符号

My file is saved as Dice.java. 我的文件保存为Dice.java。 I checked because that was one of my problems with my last program. 我查了一下,因为这是我上次课程的一个问题。 As far as the symbol error I am not sure. 至于符号错误,我不确定。

public class Dice{ <---class is Dice 公共课骰子{<---班级是骰子

public static void main(String[] args) {

// Welcome message.
    System.out.println ("Welcome to The Dice Roller Game!");

// Roll the dice. // 掷骰子。

        int die1, die2;
        int rollcount;
        rollcount = 0;
    int wins = 0;   

Scanner keyboard = new Scanner(System.in); 扫描仪键盘=新扫描仪(System.in); <----line 13 symbol error <----第13行符号错误

This is just a portion of the source code. 这只是源代码的一部分。

Classes that are not in the java.lang package must be imported to be used: 必须导入不在java.lang包中的类才能使用:

package com.foo.bar;

import java.util.Scanner;

public class Dice {
    ...

Read more about packages and imports in the Java tutorial . 阅读Java教程中有关包和导入的更多信息。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM