---
schema_version: "1"
id: 35af27916f81f207b72bcbe37e58e9c7ce1e3db1a3a0b71bbb5882e8724cefc0
title: Classes, Objects, and Interfaces
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexcode/apex_classes.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: d19af94dc78cad32938dd14a631f89560e898437c8a12debe4e9fe77a948593e
description: Apex classes are modeled on their counterparts in Java. You’ll define, instantiate, and extend classes, and you’ll work with interfaces, Apex class versions, properties, and other related class concepts.
---
# Classes, Objects, and Interfaces

Apex classes are modeled on their counterparts in Java. You’ll define, instantiate, and extend classes, and you’ll work with interfaces, Apex class versions, properties, and other related class concepts.

1. [Classes](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_understanding.htm)  
    As in Java, you can create classes in Apex. A class is a template or blueprint from which objects are created. An object is an instance of a class.
2. [Interfaces](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_interfaces.htm)  
    An interface is like a class in which none of the methods have been implemented—the method signatures are there, but the body of each method is empty. To use an interface, another class must implement it by providing a body for all of the methods contained in the interface.
3. [Keywords](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_keywords.htm)  
    Apex provides the keywords final, instanceof, super, this, transient, with sharing and without sharing.
4. [Annotations](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation.htm)  
    An Apex annotation modifies the way that a method or class is used, similar to annotations in Java. Annotations are defined with an initial @ symbol, followed by the appropriate keyword.
5. [Classes and Casting](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_casting.htm)  
    In general, all type information is available at run time. This means that Apex enables casting, that is, a data type of one class can be assigned to a data type of another class, but only if one class is a subclass of the other class. Use casting when you want to convert an object from one data type to another.
6. [Differences Between Apex Classes and Java Classes](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_java_diffs.htm)  
    Apex classes and Java classes work in similar ways, but there are some significant differences.
7. [Class Definition Creation](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_creating.htm)  
    Use the class editor to create a class in Salesforce.
8. [Namespace Prefix](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_namespace_prefix.htm)  
    The Salesforce application supports the use of namespace prefixes. Namespace prefixes are used in managed AppExchange packages to differentiate custom object and field names from names used by other organizations.
9. [Apex Code Versions](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_version_settings_intro.htm)  
    To aid backwards-compatibility, classes and triggers are stored with the version settings for a specific Salesforce API version.
10. [Lists of Custom Types and Sorting](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_list_sorting.htm)  
    Lists can hold objects of your user-defined types (your Apex classes). Lists of user-defined types can be sorted.
11. [Using Custom Types in Map Keys and Sets](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_collections_maps_keys_userdefined.htm)  
    You can add instances of your own Apex classes to maps and sets.