【问题标题】:I have issue with ADTs with Jcreator我对 Jcreator 的 ADT 有疑问
【发布时间】:2018-04-14 01:37:37
【问题描述】:

我正在使用 Jcreator 我的代码是:

import ADTs.*;

公开课 ahad1 {

/**
 * Creates a new instance of <code>ahad1</code>.
 */
public ahad1() {
}

/**
 * @param args the command line arguments
 */
public static void main(String[] args) {

    {
     Array a1 = new Array(20,5);
     int b = a1.getBase();
     int l = a1.getLength();
     System.out.println("Base = " + b + "  " + "Length = " + l);
     System.out.println("The elements of a1 are: ");
     for(int i=b; i<(b+l); ++i)
     {
     a1.put(i, i*4);
     System.out.print(a1.get(i) + " ");
     }
     Array a2 = new Array(20,5);
     a2.assign(a1);
     System.out.println();
     System.out.println("The elements of a2 are: ");
     for(int i=b; i<(b+l); ++i)
     System.out.print(a2.get(i) + " ");
     a1.setBase(10);
     System.out.println();
     System.out.println("The new base is: " + a1.getBase());
     }


      }
      }

但错误显示:

 --------------------Configuration: <Default>--------------------
    C:\Users\Dhman\Desktop\ahad\ahad1.java:9: error: package ADTs does not exist
    import ADTs.*;
   ^
  C:\Users\Dhman\Desktop\ahad\ahad1.java:25: error: cannot find symbol
  Array a1 = new Array(20,5);
  ^
     symbol:   class Array
     location: class ahad1
     C:\Users\Dhman\Desktop\ahad\ahad1.java:25: error: cannot find symbol
     Array a1 = new Array(20,5);
           ^
       symbol:   class Array
       location: class ahad1
     C:\Users\Dhman\Desktop\ahad\ahad1.java:35: error: cannot find symbol
     Array a2 = new Array(20,5);
     ^
      symbol:   class Array
       location: class ahad1
        C:\Users\Dhman\Desktop\ahad\ahad1.java:35: error: cannot find symbol
       Array a2 = new Array(20,5);
           ^
       symbol:   class Array
       location: class ahad1
       5 errors

       Process completed.

【问题讨论】:

  • 你还没有解释问题是什么?
  • C:\Users\Dhman\Desktop\ahad\ahad1.java:9: 错误:包 ADTs 不存在 import ADTs.*;
  • 你需要解释你的代码应该做什么。读者不会弄明白,他们不会很高兴能帮助你
  • 我有作业,这些是我需要做的:
  • 练习 1:编写一个 Java 程序,测试 ADTs 包中的 Array 类,以验证其所有功能,具体步骤如下: 1. 导入 ADTs 包。 2. 创建一个以 5 为底,长度为 20 的 Array 对象 a1。 3. 将 a1 的底分配给变量 b。 4.将a1的长度赋给一个变量l。

标签: jcreator


【解决方案1】:

我如何导入 ADT。*
我做不到

【讨论】:

    猜你喜欢
    • 2020-12-30
    • 2017-02-22
    • 2019-05-06
    • 1970-01-01
    • 2020-10-17
    • 2021-05-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多