public class SwappingClass { public static void swapmethod() { integer i=10, j=20; i=i+j; j=i-j; i=i-j; system.debug('check values of i = '+i); system.debug('check values of j = '+j); } }
public class Swapnumbers { public void Swapnumbersfunction(Integer x , Integer y){ x=x+y; y=x-y; x=x-y; system.debug('n1 value' +x); system.debug('n2 value' +y);
Check this code
public class SwappingClass
{
public static void swapmethod()
{
integer i=10, j=20;
i=i+j;
j=i-j;
i=i-j;
system.debug('check values of i = '+i);
system.debug('check values of j = '+j);
}
}
Thank You
Ajay Dubedi
public class Swapnumbers {
public void Swapnumbersfunction(Integer x , Integer y){
x=x+y;
y=x-y;
x=x-y;
system.debug('n1 value' +x);
system.debug('n2 value' +y);
}
}
Annoymous window:
Swapnumbers sn=new Swapnumbers();
sn.Swapnumbersfunction(6,3);
Hi karteek,
If you find this helpful mark it as the best answer.