0

I am currently working through a problem where I will be running JUnit tests

package Contact;

import java.util.ArrayList;

class ContactService {

    

    // Contacts list //
//List<contacts> aryLst = new ArrayList<contacts>( );
            private ArrayList contacts;

    // Contstructor for List //

            public ContactService() {

                contacts = new ArrayList<>();

    }

    // Adding a contact to our list //

            public boolean add(Contact contact){

        
    // Determine if the contact is present //

            boolean isPresent= false;

                for (Contact contactList:contacts) {

Every time I try to run this, it tells me "type mismatch Cannot convert element type from Object to Contact" on the line

for (Contact contactList:contacts) {

and I am not sure why? I am currently working on JUnit tests and I cannot run the

0 Answers0