Encapsulation: Encapsulation is nothing but wrapping up of data and its related functionalities in to a single unit. Encapsulation is introduced mainly to overcome problem with global variables in structured programming languages. Java developers developed the concept of Encapsulation. For instance, have a structured programming language program with twenty global variables and eight functions….