nerdexam
Salesforce

PDI · Question #121

Cloud Kicks Fitness, an ISV Salesforce partner, is developing a managed package application. One of the application modules allows the user to calculate body fat using the Apex class, BodyFat, and…

The correct answer is D. Declare the class and method using the global access modifier. For Apex components within a managed package to be accessible to subscribers outside the package's namespace, both the class and its methods must be declared with the global access modifier.

Submitted by ahmad_uae· Apr 18, 2026Logic and Process Automation

Question

Cloud Kicks Fitness, an ISV Salesforce partner, is developing a managed package application. One of the application modules allows the user to calculate body fat using the Apex class, BodyFat, and its method, calculateBodyFat(). The product owner wants to ensure this method is accessible by the consumer of the application when developing customizations outside the ISV's package namespace. Which approach should a developer take to ensure calculateBodyFat() is accessible outside the package namespace?

Options

  • ADeclare the class and method using the public access modifier.
  • BDeclare the class as global and use the public access modifier on the method.
  • CDeclare the class as public and use the global access modifier on the method.
  • DDeclare the class and method using the global access modifier.

How the community answered

(55 responses)
  • A
    5% (3)
  • B
    5% (3)
  • C
    2% (1)
  • D
    87% (48)

Why each option

For Apex components within a managed package to be accessible to subscribers outside the package's namespace, both the class and its methods must be declared with the `global` access modifier.

ADeclare the class and method using the public access modifier.

The `public` access modifier restricts access to components within the same application or namespace and does not allow external access from outside a managed package.

BDeclare the class as global and use the public access modifier on the method.

While the class is `global`, a `public` method within a `global` class will not be accessible outside the package's namespace; the method itself must also be `global`.

CDeclare the class as public and use the global access modifier on the method.

If the class is `public`, it cannot be accessed from outside the package's namespace, rendering a `global` method within it inaccessible to subscribers.

DDeclare the class and method using the global access modifier.Correct

To allow external access from outside the package's namespace, both the Apex class (`BodyFat`) and its method (`calculateBodyFat()`) must be declared using the `global` access modifier.

Concept tested: Apex access modifiers for managed packages

Source: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_access_modifiers.htm

Topics

#Apex Access Modifiers#Managed Packages#Apex Visibility

Community Discussion

No community discussion yet for this question.

Full PDI Practice