找不到Java自定义类:错误:找不到符号

时间:2016-12-12 03:52:07

标签: java javac

我有以下Subset.java文件:

package week2;

import edu.princeton.cs.algs4.StdOut;
import edu.princeton.cs.algs4.StdIn;

public class Subset {

    public static void main(String[] args) {
        int k = Integer.parseInt(args[0]);
        RandomizedQueue<String> randQueue = new RandomizedQueue<String>();
        while (!StdIn.isEmpty()) {
            randQueue.enqueue(StdIn.readString());
        }

        for (int i = 0; i < k; i++) {
            StdOut.println(randQueue.dequeue());
        }
    }

}

同一文件夹中还有RandomizedQueue.java。但是,当我在终端中运行javac-algs4 Subset.java时,出现以下错误:

Subset.java:10: error: cannot find symbol
        RandomizedQueue<String> randQueue = new RandomizedQueue<String>();
        ^
  symbol:   class RandomizedQueue
  location: class Subset
Subset.java:10: error: cannot find symbol
        RandomizedQueue<String> randQueue = new RandomizedQueue<String>();
                                            ^
  symbol:   class RandomizedQueue
  location: class Subset
2 errors

(请原谅,我是Java的新手。)

0 个答案:

没有答案