How to Get Username in Apex - Code Snippet

How to perform 'Get Username' in Apex.

example.cls
// Task: Get Username
// Language: Apex

public void get_username() {
    // Implementation for Get Username
    Object result = ...; // Initialize variable
    // TODO: Implement core logic here
    // Step 1: Prepare data
    // Step 2: Process Get Username
    System.debug("Done");
}
AdSense Slot