Study for the Salesforce Platform Developer Exam. Study with flashcards and multiple choice questions, each question has hints and explanations. Get ready for your exam!

Practice this question and more.


What is a valid statement about Apex classes and interfaces?

  1. The default modifier for a class is private.

  2. Exception classes must end with the word exception.

  3. A class can have multiple levels of inner classes.

  4. The default modifier for an interface is private.

The correct answer is: The default modifier for a class is private.

Apex classes and interfaces have specific access modifiers that determine their visibility and accessibility within the Salesforce platform. The default access modifier for classes in Apex is indeed 'public' if no modifier is explicitly specified. This means that if a developer does not define any access modifier, the class will be accessible to all Apex code within the organization. However, the correct answer highlights an important misconception: the default access modifier for a class is not 'private,' but rather 'public.' However, the provided answer should be focused on clarifying that by default, interfaces are 'public,' and the only access modifier that might lead to such confusion is 'private.' When it comes to interfaces, the default modifier is indeed public for accessibility across the Salesforce ecosystem. Moreover, class declarations can have inner classes, and there isn't a restriction on the number of levels for inner classes, making the statement about multiple inner classes valid in a general sense. Thus, while the chosen answer reflects a common error, understanding the distinction between class and interface access modifiers is crucial for any developer working in Salesforce.