Search Here

String, Integer ,List, Map

 public class DataTypesExample {

    public Integer integerVariable;

    public String stringVariable;

    public List<String> stringList;

    public Map<String, Integer> stringToIntegerMap;


    public static void main() {

        DataTypesExample example = new DataTypesExample();

        

        example.integerVariable = 42;

        example.stringVariable = 'Hello, World';

        

        example.stringList = new List<String>{'Red', 'Green', 'Blue'};

        

        example.stringToIntegerMap = new Map<String, Integer>{

            'One' => 1,

            'Two' => 2,

            'Three' => 3

        };

        

        System.debug('Integer: ' + example.integerVariable);

        System.debug('String: ' + example.stringVariable);

        System.debug('List: ' + example.stringList);

        System.debug('Map: ' + example.stringToIntegerMap);

    }

}



Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.