I have an SBT project that has a number of classes declared as java files. Two of them are Table.java and LinHashMap.java. They are both in the
directory. I want to create and refer to a LinHashMap object in the Table class. I thought that since they are in the same directory I don't have to include an import statement. Am I wrong? When I compile I get the error:
[error] src/main/java/cs4370/Table.java:90: cannot find symbol
[error] symbol: class LinHashMap
[error] location: class Table
[error] index = new LinHashMap <> (Comparable .class, Comparable .class);
You need to declare them as being in the same package :
Being in the same folder only implies that the compiler will know where to look for the files. Being in the same package is required to not have to use fully specified class name.
That is actually the definition of what 'import' is used for.