232k views
3 votes
Which access modifier explicitly says that a method or variable of an object can be accessed by code from outside of the class of that object?

(A) private
(B) public
(C) default
(D) static

1 Answer

5 votes

Answer:

B

Step-by-step explanation:

public access specifier is used to access the objects outside the class.if it is private we can not access that outside the class.Public is useful when you want to expose some data which is useful to the user and private is used to hide the confidential data from the user

User Pierre Irani
by
5.7k points