(Lesson 4)
What is Difference Between Private and Public In OOP
Hi guys, In our last lesson(if you missed it going through this link) we explained what is class and object. in that case you can see private and public keywords in java code. We called them to Access Modifiers. Today I will explain difference between private and public in Java Language.
What is private ?
The private part of the definition speficies the data members of a class. These are hidden, not accessible outside the class and only can be accessed through the operations defined in the class
What is public ?
The public part of the definiton specifies the operations as functions prototypes. These operations, or methods as referred in java, can be accessed by the main program.
Terminology
I hope now you have an idea about difference between private and public access modifiers. In next article I will explain how to create objects in Java.
Good Day!