What is the difference between private and protected specifiers ? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 2

What is the difference between private and protected specifiers ?

Needs explaination with their properties.....thanks

20th Aug 2017, 5:39 PM
Hemant Jaiswal
Hemant Jaiswal - avatar
1 Respuesta
+ 2
`private` hides from other classes within the package. `public` exposes to classes outside the package. `protected` is a version of `public` restricted only to subclasses. you may find detailed docs here http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html
20th Aug 2017, 6:24 PM
Melih Melik Sonmez
Melih Melik Sonmez - avatar