I have a project I created in NetBeans IDE with 3 files – ReadFileString, which has my main, BagInterface, and ArrayBag which implements the interface. They are all in the same folder and I am in it via terminal. It should be able to compile and run from the command line using only “javac ReadStringFile.java”. However, whenever I try to do this, I get the following error:
S:DocumentsNetBeans ProjectsReadFileStringsrcreadfilestring>javac ReadFileString.java
ReadFileString.java:26: error: cannot find symbol
var userBag = new ArrayBag<String>();
^
symbol: class ArrayBag
location: class ReadFileString
1 error
I tried changing my declaration from var userBag = new ArrayBag<String>();
to BagInterface<String> userBag = new ArrayBag<>();
but it only caused an issue not being able to find BagInterface either. I tried changing the package import from package readfilestring;
to a few others but it only caused more errors.
M B is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
8