Follow these steps to implement the example:
- Create a class named Contact:
public class Contact {
- Declare two private String attributes named name and phone:
private final String name; private final String phone;
- Implement the constructor of the class to initialize its attributes:
public Contact(String name, String phone) { this.name=name; this.phone=phone; }
- Implement the methods to return the values of the name and phone attributes:
public String getName() { return name; } public String getPhone() { return phone; }
- Create a class named Task and specify that it implements the Runnable interface:
public class Task implements Runnable {
- Declare a private ConcurrentSkipListMap attribute, parameterized ...