we have a Map that contains,
John, Is a Name Java, Is a Language
As Key and Value pair.
Now, let us say, we want to update the entry,
John, Is a Name
With
John, Is an English Name
Where John is the Key and Is an English Name is its corresponding Value.
Let us see in the below example.
import java.util.*;
public class MyApplication {
public static void main(String[] args) {
Map x = new HashMap<>();
x.put("John", "Is a Name");
x.put("Java", "Is a Language");
x.put("John", "Is an English Name");
System.out.println(x);
}
}
In the above example, we have the Map with the following Entries.

So, for the Key John, the initial value was Is a Name.
x.put("John", "Is a Name");And we wanted to add a new entry with the Key as John and the Value as Is an English Name.
x.put("John", "Is an English Name");Now, if we see the output.
We can see that the Key John is updated with the new value Is an English Name.
