As you probably know, for a long time (about 5 weeks) I started to learn Java from scratch. Today, I have decided to take a look at one of the exam problems at the Software University and I have spent some…