Question: I am making a fraction calculator in java for school. I am trying to find the greatest common divisor using arrays but I keep getting

I am making a fraction calculator in java for school. I am trying to find the greatest common divisor using arrays but I keep getting an error telling me there is no suitable method found for add(ArrayList)

//Find the greatest common divisor //Find the common factors for(int i =0; i < numFactors.size(); i++){ for(int j =0; j

here is the error I am getting

error: no suitable method found for add(ArrayList) greatestCd.add(numFactors); ^ method Collection.add(Integer) is not applicable (argument mismatch; ArrayList cannot be converted to Integer) method List.add(Integer) is not applicable (argument mismatch; ArrayList cannot be converted to Integer) method AbstractCollection.add(Integer) is not applicable (argument mismatch; ArrayList cannot be converted to Integer) method AbstractList.add(Integer) is not applicable (argument mismatch; ArrayList cannot be converted to Integer) method ArrayList.add(Integer) is not applicable (argument mismatch; ArrayList cannot be converted to Integer) RodriguesP1.java:159: error: no suitable method found for add(ArrayList) greatestCd.add(denFactors); ^ method Collection.add(Integer) is not applicable (argument mismatch; ArrayList cannot be converted to Integer) method List.add(Integer) is not applicable (argument mismatch; ArrayList cannot be converted to Integer) method AbstractCollection.add(Integer) is not applicable (argument mismatch; ArrayList cannot be converted to Integer) method AbstractList.add(Integer) is not applicable (argument mismatch; ArrayList cannot be converted to Integer) method ArrayList.add(Integer) is not applicable (argument mismatch; ArrayList cannot be converted to Integer) Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output 2 errors

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!