What is the deference of private class with other classes? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 11

What is the deference of private class with other classes?

I want know better description of this.

23rd May 2019, 2:11 AM
Mozhda Arvin
Mozhda Arvin - avatar
2 Answers
+ 4
https://stackoverflow.com/questions/215497/what-is-the-difference-between-public-protected-package-private-and-private-in Use this form for more info in this topic! & tick that tick mark in the left side of my answer, cause it gives me XP 😀
23rd May 2019, 4:08 AM
Abdol Hashimi
Abdol Hashimi - avatar
+ 2
Private Methods,Variables and Constructors Methods, Variables and Constructors that are declared private can only be accessed within the declared class itself. Class and Interface Private access modifier is the most restrictive access level. Class and interfaces cannot be private. Note Variables that are declared private can be accessed outside the class if public getter methods are present in the class. Variables, methods and constructors which are declared protected in a superclass can be accessed only by the subclasses in other package or any class within the package of the protected members' class. Public A class, method, constructor, interface etc declared public can be accessed from any other class. Therefore fields, methods, blocks declared inside a public class can be accessed from any class belonging to the Java Universe. you can never ever make a class private🤓
23rd May 2019, 4:06 AM
Abdol Hashimi
Abdol Hashimi - avatar