I am programming a caching system which can store any object. I have these two classes:
public class Cache<T> { ... }
public class CacheDriver<T> { private Cache<T> cache1, cache2; }
I also have a Test class which contains my main method and the testing code.
public class Test { CacheDriver<String> c; }
When I try to compile from the command line with
javac Test.java
I get this:
Test.java:8: error: cannot find symbol
private CacheDriver<String> c;
^
symbol: class CacheDriver
location: class Test
I also have the same errors when I instantiate CacheDriver objects with:
c = new CacheDriver(Integer.parseInt(args[0]), Integer.parseInt(args[1]));
I've done a little research and think it may have something to do with my generic T and the two classes not sharing the same one, but I don't know how to fix that. How do I do it?
EDIT: I they were inside of a package. I moved them form the package directly to the src folder and it worked. Not exactly sure why, but I'll take it.