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.A.
The correct statement about an Apex class is option A - Static methods can only be declared in a top-level class definition.
Let's look at each option in detail:
Option A: Static methods can only be declared in a top-level class definition. This statement is true. Static methods can only be declared in a top-level class definition, and cannot be declared in inner classes. Static methods are accessed using the class name, not an instance of the class, so they don't have access to instance variables and methods.
Option B: Utilize the String.escapeSingleQuotes(string) method This statement is incomplete and doesn't make sense on its own. The String.escapeSingleQuotes() method is used to escape single quotes in a string so that the string can be safely used in a SOQL query or in dynamic Apex. However, it doesn't have anything to do with an Apex class.
Option C: HTTP class, HTTPRequest class, HTTPResponse class This statement lists some of the classes in the Apex HTTP classes, which are used to make HTTP requests and handle responses. However, it doesn't provide any information about Apex classes in general.
Option D: Database class method. This statement is incomplete and doesn't make sense on its own. The Database class in Apex provides methods for DML (Data Manipulation Language) operations, such as insert, update, and delete. However, it doesn't provide any information about Apex classes in general.
In conclusion, the correct statement about an Apex class is that static methods can only be declared in a top-level class definition.