website counters

Thursday, October 6, 2016

Swapping(call by value)

/*Swapping-pass by value */


class Swapping{

    void swapping(int x,int y){

        int temp=x;
        x=y;
        y=temp;

        System.out.println("After swap by value: X:"+x+" y:"+y);
    }

    public static void main(String[] args){

        Swapping object=new Swapping();

        object.swapping(4,5);
    }
}

No comments:

Post a Comment