Hello. I'm working on a
java assignment for school and I keep getting this one error message. My teacher gave us an abstract class that includes two abstract methods and a HashSet. We have to extend the abstract class and define these methods. When I try a command like:
HashSet.add(new apple())
or
HashSet.size()
in one of the methods I am defning, I get these errors:
non-static method add(java.lang.Object) cannot be referenced from a static context
non-static method size() cannot be referenced from a static context
Does anyone know what's going on?