+ 2

How we can use protected & private ?

as from the name guys you would know that it is related to JAVA . My question is how i can use this two keyword in any programming, cause nothing I can know, understanding, in this two part. Explain me with detail without giving any "link" to read.

15th Dec 2017, 8:31 AM
šŸ¦‹FEATHERšŸ¦‹
šŸ¦‹FEATHERšŸ¦‹ - avatar
4 Answers
+ 2
i need some more.
15th Dec 2017, 8:59 AM
šŸ¦‹FEATHERšŸ¦‹
šŸ¦‹FEATHERšŸ¦‹ - avatar
+ 2
What exact details do you want? It is access modifiers they control access :) You can decide what to hide and what to expose. It is a part of oop encapsulation principle, you can use it as you wish in terms of your app design...
15th Dec 2017, 9:23 AM
Dima Makieiev
Dima Makieiev - avatar
+ 2
thanks @Dima
16th Dec 2017, 2:45 AM
šŸ¦‹FEATHERšŸ¦‹
šŸ¦‹FEATHERšŸ¦‹ - avatar
0
Normally you use private when you need to hide some variable or methods from outside world. It is done to force loose coupling between different classes and in case of external access to protect from non auth. Protect is for the same purpose but it allows you to inherit such variable or method.
15th Dec 2017, 8:57 AM
Dima Makieiev
Dima Makieiev - avatar