Private Keyword In Java
Private is an access modifier hence we can use it to make a class, attribute, method, etc private.
Private keyword is used when we want to make something only accessible within the boundary of the declared class.
private is a reserved word hence it will always be written in lower case.\
Now we will see an example -
Example 1 -
Output -
Example 2 - Now we will see what will happen if we try to access a private keyword outside the boundary of a class.
Output -