Which of the following is true of public methods?
A) They can only be accessed by methods in the same package
B) They can only be accessed by methods in the same class
C) They can only be accessed by methods in a different package
D) They can be accessed by any method in the same program

Respuesta :

Baraq

Answer:

D) They can be accessed by any method in the same program

Explanation:

Public methods is a form of access modifier in a programming language such as Java, Phython, C#. However, unlike other types of access modifiers like Private Methods, Protected Methods etc they do not put any form of restriction on the access. Hence, in Public Methods members, methods and classes can be accessed from anywhere.

Therefore, what is true of Public Methods is that, they can be accessed by any method in the same program