fork download
  1. public with sharing class DataType {
  2.  
  3. // Primitive Data type ->
  4. // -> Boolean , Integer , Long , Decimal , Double , String , Id
  5.  
  6. // Special Data Types ->
  7. // -> Date , Time , Datetime , Blob
  8.  
  9.  
  10.  
  11. public DataType() {
  12.  
  13. }
  14.  
  15. public static void DataTypesAll(){
  16. System.debug('Jay Ganesh');
  17.  
  18. // Primitive Data type
  19. // -> Boolean , Integer , Long , Decimal
  20. // -> Double , String , Id
  21.  
  22. Boolean isActive = true;
  23. Integer count = 100;
  24. Long bigNumber = 98765432123456L;
  25. Decimal price = 99.99;
  26. Double ratio = 4.14159;
  27. String name = 'Apex Developer';
  28. Id recordId = '0015g00000N8N1oAAF';
  29.  
  30. System.debug(isActive);
  31. System.debug(count);
  32. System.debug(bigNumber);
  33. System.debug(price);
  34. System.debug(ratio);
  35. System.debug(name);
  36. System.debug(recordId);
  37.  
  38. // Special Data Types
  39. // -> Date , Time , Datetime , Blob
  40.  
  41. Date today = Date.today();
  42. //Time now = Time.now();
  43. Datetime currentDateTime = Datetime.now();
  44.  
  45. Blob binaryData = Blob.valueOf('Apex Blob Data');
  46.  
  47. System.debug(today);
  48. //System.debug(now);
  49. System.debug(currentDateTime);
  50. System.debug(binaryData);
  51.  
  52. // Collections
  53. // -> List , Set , Map
  54.  
  55. List<String> fruits = new List<String>{'Apple','Orange','Banana'};
  56. System.debug(fruits);
  57.  
  58. // For loop
  59.  
  60. for(Integer i=1;i<=fruits.size();i++){
  61. System.debug(fruits[i]);
  62. }
  63.  
  64. // For Each loop
  65.  
  66. for(String fruit : fruits){
  67. System.debug(fruit);
  68. }
  69.  
  70. // While loop
  71.  
  72. Integer j = 1 ;
  73. while(j<=fruits.size()){
  74. System.debug(fruits[j]);
  75. j++;
  76. }
  77.  
  78. // Do-While loop
  79.  
  80. // Integer k = 1;
  81. // do{
  82. // System.debug(fruits[k]);
  83. // i++;
  84. // }while(i<=fruits.size())
  85.  
  86. // List Iterator
  87.  
  88. // Iterator<String> fruitIterator = fruits.iterator();
  89. // while(fruitIterator.hasNext(){
  90. // System.debug(fruitIterator.next());
  91. // })
  92.  
  93.  
  94. }
  95. }
  96.  
  97. DataType.DataTypesAll();
  98.  
  99.  
  100.  
Success #stdin #stdout #stderr 0.01s 8980KB
stdin
Standard input is empty
stdout
Object: nil error: did not understand #with
MessageNotUnderstood(Exception)>>signal (ExcHandling.st:254)
UndefinedObject(Object)>>doesNotUnderstand: #with (SysExcept.st:1448)
UndefinedObject>>executeStatements (prog:1)
stderr
./prog:3: parse error, expected '}'