【问题标题】:Does anybody know why i'm getting "error: class, interface, or enum expected"?有人知道为什么我会收到“错误:预期的类、接口或枚举”吗?
【发布时间】:2014-06-20 08:55:27
【问题描述】:

我正在 JCreator 中创建一个简单的类,但我不确定为什么会收到“错误:类接口或预期的枚举”。这是我的代码:

    public int class javatest 
    {

        public javatest() 
        {
            double coin=168.22;
            int quarter=0;
            int dime=0;
            int nickel=0;
            if (coin>.25)
            {
            coin-=.25;
            quarter++;
            return coin;
            }
        }
     }

【问题讨论】:

  • 您在class 关键字之前有一个非法令牌。删除int

标签: class interface enums jcreator


【解决方案1】:

改变

public int class javatest {....

public class javatest {

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-04-09
    • 1970-01-01
    • 2012-10-05
    • 2013-12-23
    • 2015-06-15
    • 1970-01-01
    • 1970-01-01
    • 2016-09-24
    相关资源
    最近更新 更多