in JAVA by
Q:
Explain about Public and Private access specifiers.

Methods and instance variables are known as members.

Public:

Public members are visible in the same package as well as the outside package that is for other packages.

Public

Public members in Class A are visible to Class B (Same package) as well as Class C (Different package).

Private:

Private members are visible in the same class only and not for the other classes in the same package as well as classes in the outside packages.

Private

Private members in class A is visible only in that class. It is invisible for class  B as well as class C.

Related questions

+1 vote
0 votes
asked Dec 5, 2020 in Tableau by SakshiSharma
0 votes
asked Jan 29, 2020 in AWS by SakshiSharma
0 votes
asked Jun 17, 2020 in Amazon Elastic Compute Cloud EC2 by Robindeniel
0 votes
asked Jun 17, 2019 in JAVA by reins.robin
0 votes
asked Feb 9 in JAVA by SakshiSharma
...