When compiling, we may often see errors something like this:
error: cannot find symbol
symbol: class ArrayList
location: class Lab
Resolution
Generally this error can be resolved by importing a class that matches the missing symbol.
Importing a class means we are telling Java to "import" the specified class into our scope. In other words, the import class becomes available for use.
How To
For the problem above, we can see we are missing "ArrayList". So we would resolve by putting this import line at the top of our JAVA file:
import java.util.ArrayList;
How do we know the full path "java.util.ArrayList"?
The easiest way is to do an internet search for the missing symbol.
E.g. search for something like:
That gives us the full path to import (by appending the class name):
import java.util.ArrayList
Note that Oracle is the Java vendor who provides a large library of Java classes that you will use. So you can even narrow your search to something like:
"Java Oracle ArrayList"
.
Future work
Note that later on in your Java work you will start importing your own classes. This will be after you start to organize your code into different packages.