Question: Java Can you show it? By implementing into the code! The PetDatabase class has a public method called deleteCats. It takes one parameter, age of
Java
Can you show it? By implementing into the code!


The PetDatabase class has a public method called deleteCats. It takes one parameter, age of int type, and deletes the cats that are older than the given age. It retums the number of cats deleted Which one is the correct definition of the method? Select one public int deleteCats(int age) { Int count ; for (int k = 8; * age) { cats.remove(); count return count; public int deleteCats(int age) Int count = 0; int k-cats.size(); while (>0){ if (cats.get().getAge() it = cats.iterator(); while (it.hasNext()) { if ( it.next().getAge() > age ) { it.remove(); count++; } return count; } public int deleteCats(int age) { int count = 0; for (Cat c: cats) { if (c.getAge() > age ) { cats.remove(c); count++; } 1 return count; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
