COMPARATIVE ANALYSIS OF ENCAPSULATION IN JAVA AND PYTHON: SYNTAX AND IMPLEMENTATION DIFFERENCES - Omer, Skala Kamaran; Mirkhan , Star Dawood; Hussein, Nyan Najat; Ali, Aveen Zuber; Rashid , Tarik Ahmed; Nedunchezhian, Poornima (Journal of Duhok University, 2023)
Encapsulation is a fundamental principle of object-oriented programming, which allows for the hiding of implementation details and the protection of data from unauthorized access. This paper evaluates the concept of encapsulation in the programming languages Java and Python. The study examines the ways in which encapsulation is implemented in each language, including access modifiers and methods of data hiding. This research paper’s findings demonstrate that while both languages support encapsulation, the syntax and specific implementation vary in each of them. In particular, Java's use of access modifiers such as private, protected and public allows for a stricter level of encapsulation compared to Python's use of the '_' and '__' prefix to denote private variables and methods.