package com.example;
import java.util.ArrayList;
import java.util.List;
public class example {
public static void main(String[] args) {
Employee e1 = new Employee("Jeny", 22, "Chennai");
Employee e2 = new Employee("Justin", 22, "Mumbai");
Employee e3 = new Employee("Esha", 22, "Pune");
Employee e4 = new Employee("Saumya", 22, "Trichur");
List<Employee> al = new ArrayList<>();
al.add(e1);
al.add(e2);
al.add(e3);
al.add(e4);
System.out.println(al);
}
}
Hi everyone i am new to coding in java and to stack overflow. This is just something that I was trying. I'm trying to understand how will I use the contains method to know if the element "Jeny" or any other element is contained. I don't know if contains method is the only way to do it. But its what Ive been trying at the moment. Help please.