Home » Microsoft » MB-500 » HOTSPOT
HOTSPOT
You are a Dynamics 365 Finance developer. You have the following code: (Line numbers are created for reference only.)
Which values does the info() method return? To answer, select the appropriate option in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:
Correct Answer:
Explanation/Reference:
Explanation:
Box 1: SID1234 Parameters All methods have their own scope. A method can take one or more parameters. Within the scope of the method, these parameters are treated as local variables and are initialized with a value from the parameter in the method call. All parameters are passed by value, which means that you can’t change the value of the original variable. You can change only the local variable in the method. This local variable is a copy of the original variable.
Box 2: 5 Reference:
https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/dev-ref/xpp-classes-methods
This is so wrong. Pass by value only for primitive data type variables, pass by ref for object variables.
Try this code in a dev box and see for yourself what info method shows in output.
class RunnableClass1
{
public static void main(Args _args)
{
RunnableClass1 job1 = new RunnableClass1();
job1.run();
}
public void run()
{
CustTable ct;
ct.AccountNum = ‘GJ’;
Info(ct.AccountNum);
this.updateTest(ct);
Info(ct.AccountNum);
}
public void updateTest(CustTable _ct)
{
CustTable newCT = _ct;
newCT.AccountNum = ‘newGJ’;
}
}