public void assignAndSwap Point p1 Point p2 p1 10 p1 10 Point temp p1

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
public void assignAndSwap(Point p1, Point p2)
{
p1.x = 10;
p1.y = 10;
Point temp = p1;
p1 = p2;
p2 = temp;
}
public static void main(String [] args)
{
Point p1 = new Point(0,0);
Point p2 = new Point(0,0);
System.out.println("OUTPUT 1: point1==" + p1 + " point2==" + p2)
assignAndSwap(p1, p2);
System.out.println("OUTPUT 2: point1==" + p1 + " point2==" + p2)
}