Question: I'm creating a Java code and getting an error > TestClass.java:27: error: method isEmpty in class LetterInventory cannot be applied to given types; if(v.isEmpty()) {

I'm creating a Java code and getting an error >

TestClass.java:27: error: method isEmpty in class LetterInventory cannot be applied to given types; if(v.isEmpty()) { ^

There are 2 Java files causing the conflict: File #1 LetterInventory (compiles without issue) and File #2 TestClass (the one getting the error codes).

The 1st error code results from these files:

File #1:

 public int size() { return size; } public boolean isEmpty(LetterInventory p) { if(size == 0) { return true; } return false; }

File #2:

 Scanner scan = new Scanner(System.in); System.out.println("This is a Letter Inventory!"); System.out.println("Please type a word of one or more characters: "); String insert = scan.next(); LetterInventory v = new LetterInventory(insert); if(v.isEmpty()) { System.out.println("Please include at least one character."); insert = scan.next(); v = new LetterInventory(insert); } scan.close();

Please help! If you could also give an example of what would work in the code, that would be amazing

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!