Online Java Compiler By
JavaTpoint.com
import java.util.Scanner; import java.util.concurrent.LinkedTransferQueue; class Employee{ public static String name; static String date; public Employee(String name, String date) { this.name = name; this.date = date; } } public class LinkedTransferQueueContainsExample3 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); LinkedTransferQueue
queue = new LinkedTransferQueue
(); Employee employee1=new Employee("Jack","31.08.18"); Employee employee2=new Employee("Marry","31.08.18"); Employee employee3=new Employee("Johnson","31.08.18"); Employee employee4=new Employee("Harry","31.08.18"); queue.add(employee1); queue.add(employee2); queue.add(employee3); queue.add(employee4); if (queue.contains(employee2)){ System.out.println("Marry is present on "+Employee.date); } else{ System.out.println("Marry is absent on "+Employee.date); } } }
Output