A key-value pair is two values usually connected in such a way that the value is accessed using the key. They are commonly used in various data-structures to provide fast access to values. Check out hashtable data structure for instance (in Java, you can take a look at HashMap or Hashtable)
For example, let's say we have a structure CartoonCharacter
holding the mentioned pairs like:
This key-value relationship would look something like:
CartoonCharacter[lastName] = "Bunny";
So if you want to get the value Bunny
you would access it through the key lastName
.
key = "lastName"
value = CartoonCharacter.get(key)
print (value) // this would print "Bunny"