I'm creating a Java code and keep getting this error > TestClass.java:26: error: non-static method isEmpty(LetterInventory) cannot
Fantastic news! We've Found the answer you've been seeking!
Question:
I'm creating a Java code and keep getting this error >
TestClass.java:26: error: non-static method isEmpty(LetterInventory) cannot be referenced from a static context
I have code from 2 separate Java files that are conflicting.
For the first file, LetterInventory, it compiles without issue. I have:
public int size() { return size; } // end size // If Letter Inventory is empty, returns true. // If Letter Inventory is not empty, returns false. public boolean isEmpty(LetterInventory p) { if(size == 0) { return true; } return false;
The 2nd file, TestClass, is the one giving me the error:
String insert = scan.next(); LetterInventory v = new LetterInventory(insert); if(LetterInventory.isEmpty(v)) {
There are a few more pieces of code surrounding it, but it's mostly println's, so I don't think it has anything to do with it.
Please help! If you could also give an example of what would work in the code, that would be amazin.g
Related Book For
Introduction To Programming With Java A Problem Solving Approach
ISBN: 9781260575248
3rd International Edition
Authors: John Dean
Posted Date: