The K-nearest neighbors (KNNs) classifier or simply Nearest Neighbor Classifier is a kind of supervised machine learning algorithm that operates based on spatial distance measurements. In this article, we investigate the theory behind it. Furthermore, a working example of the k-nearest neighbor classifier will be represented.