6

私はこのコードを実行しようとしています:

import java.util.*;

public class ScanReg {
  public Map<Integer, ArrayList<Long>> scanMap = new HashMap<Integer, ArrayList<Long>>();
}

このクラス内:

import java.util.*;

public class NxtStart {
  ScanReg sr = new ScanReg();
}

これにより、次のエラーが発生し続けます。

.\ScanReg.java:6: error: cannot find symbol
        public Map<Integer, ArrayList<Long>> scanMap = new HashMap<Integer, Arra
yList<Long>>();
               ^
  symbol:   class Map
  location: class ScanReg
.\ScanReg.java:6: error: cannot find symbol
        public Map<Integer, ArrayList<Long>> scanMap = new HashMap<Integer, Arra
yList<Long>>();
                                                           ^
  symbol:   class HashMap
  location: class ScanReg
2 errors

誰かが理由を教えてもらえますか?

4

2 に答える 2

2

Java 1.4 とジェネリックを使用してコンパイルしている可能性があります (1.5 以降でのみ使用可能)。

于 2011-10-23T01:36:25.217 に答える