Posted By:
Thanigai_Venkatesan
Posted On:
Thursday, June 7, 2001 07:00 AM
Hi P T
The below code does the swapping, which uses the simple swapping logic, i don't think Java provides
any API for that. Let me know, what you asked is this or not.
Coord coord1 = new Coord(10,20); // Assume you have constructor which takes X, Y, here X = 10 and Y = 20
Coord coord2 = new Coord(30,40);
Coord temp = new Coord();//Constructor with no parameters.
temp.X = coord1.X;
temp.Y = coord1.y;
coord1.X = coord2.X;
coord1.Y = coord2.Y;
coord2.X = temp.X;
coord2.Y = temp.Y;
Cheers