【问题标题】:calling Generic class in Bean class method gives error在 Bean 类方法中调用泛型类会出错
【发布时间】:2019-02-28 09:01:25
【问题描述】:

我正在尝试编译导入我的包之一的 serviceBean.java 文件,ledgement.java

在serviceBean.java中我添加了下面一行,它没有编译它抛出Cannot Find Symbol

ledgement ack = new ledgement(false,
                        e);

Here is the folder structure:

C:\working\src\java\com\test\tools\abc\mgmt\facade\service    

com/test/tools/abc/mgmt/facade/service/serviceBean.java

com/test/tools/abc/mgmt/util/ledgement.java

我的分类帐类包含

 public class ledgement<T> extends Test {

        public enum EntityType implements Serializable {
            ART(1), ART1(2), RDER(3), LNE(4), 
            COUNT(5);
            private int typeId;

            EntityType(int id) {
                this.typeId = id;
            }

            /**
             * @return the entityClass
             */
            public int getTypeId() {
                return typeId;
            }

            /**
             * @param entityClass
             *            the entityClass to set
             */
            public void setTypeId(int id) {
                this.typeId = id;
            }
        } // Enum EntityType.

    public ledgement(boolean successFg) {
            this(successFg , null, null, null, null);
        }
   public ledgement(boolean sucessFg, Exception exp) {
        this(sucessFg, exp, null);
    }

它抛出找不到符号 [javac] 符号:构造函数ledgement(boolean,java.lang.Exception )

Not sure what is the issue by invoke the ledgment java class.
Please help.Thanks in Advance

【问题讨论】:

  • 你有import com.test.tools.abc.mgmt.util.ledgementServiceBean 类吗?
  • 是的,已经导入了
  • 当您在构造函数上调用 e 变量时,它是否已实例化?

标签: java compiler-errors javac java-6


【解决方案1】:

您在这行代码中有一个额外的括号: this(successFg) , null, null, null, null);

【讨论】:

  • e 被实例化
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-08-29
  • 2012-04-21
  • 1970-01-01
  • 2012-11-27
  • 2012-01-11
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多