Which statement is true about an Apex class? -> A class cannot be disabled for profiles.
-> An inner class can be nested at multiple levels.
-> Static methods can only be declared in a top-level class definition.
-> The default access modifier for methods in a class is public.
Click on the arrows to vote for the correct answer
A. B. C. D.C.
The correct statement about an Apex class is: -> Static methods can only be declared in a top-level class definition.
Let's break down the other statements and explain why they are incorrect:
-> A class cannot be disabled for profiles. This statement is incorrect. In Salesforce, you can disable access to a class for certain profiles by setting the class's access level to "hidden". This prevents users with that profile from being able to execute or even see the class.
-> An inner class can be nested at multiple levels. This statement is correct. In Apex, you can define a class inside another class. These are called inner classes. You can also define an inner class inside an inner class, and so on.
-> The default access modifier for methods in a class is public. This statement is incorrect. In Apex, the default access modifier for methods is actually "private". This means that methods can only be accessed within the same class. If you want to allow other classes to access a method, you need to explicitly declare it as "public".
Therefore, the correct answer is C. Static methods can only be declared in a top-level class definition. In Apex, static methods are methods that belong to the class itself, rather than to any instance of the class. These methods can be called without creating an instance of the class first. However, static methods can only be declared in a top-level class definition, not in an inner class.