Explain Casting in salesforce?



Explain Casting in salesforce?..

Answer / Ajay Kumar Mishra

In Salesforce Apex, casting is the process of converting one data type to another. This can be done using explicit and implicit casting.n
1. Explicit casting: This requires using the appropriate conversion function or operator. For example:nString myString = '123';nInteger myInt = Integer.valueOf(myString);n
2. Implicit casting: This happens automatically when you try to assign a value of one data type to another compatible data type.nFor example:nDouble myDouble = 123;nInteger myInt = (Integer)myDouble; // No need for explicit conversion here.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Salesforce Interview Questions

How does apex work?

1 Answers  


Can we avoid duplicates using apex data loader which we can do through import wizard? : salesforce Data Management

1 Answers  


What will happen if we delete child object in case of look up relationship and master detail relationship? : salesforce objects & fields

1 Answers  


How to clear the time based workflow action queue?

1 Answers  


Explain how many controllers can be used in a visual force page?

1 Answers  


If object-level permissions conflict with record-level permissions, then what will happen? : salesforce sharing and security

1 Answers  


What is Profile and Components?

1 Answers  


State what are custom reports in salesforce? What are custom report types?

1 Answers  


How can we prevent to cross the governor limit from soql query?

1 Answers   Cognizant,


Syntax for upsert & undelete trigger & purpose undelete?

1 Answers  


What is aura definition bundle?

1 Answers  


How to identify if a class is a test class? : salesforce crm

1 Answers  


Categories