Problem

Complete the given apex method to add two random string values into the a list and return the list.

Instructions

  • The apex method accepts no input parameters.
  • Define a list with the data type string.
  • Add two strings into the list and return the list.

Sample output

List outputList = listController.addTwoElements();

//outputList size is 2

Note : This exercise introduces you to writing a simple apex method to add two string values into a list. Focus on meeting the requirements, and feel free to validate your code using the execute button.

To learn more about list methods in apex, visit the official documentation here.