Comparative Analysis of Encapsulation in Java And Python: Syntax And Implementation Differences

Skala Kamaran Omer, Star Dawood Mirkhan, Nyan Najat Hussein, Aveen Zuber Ali, Tarik Ahmed Rashid, Poornima Nedunchezhian · The Journal of The University of Duhok · 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.

Read the paper · More papers on PaperTik