What is the output of the following Java program? Explain in terms of how parameters are passed in Java.
import java.awt.*;
class PointParameters
{
public static void main(String [] args)
{
int x = 1, y = 1;
Point p = new Point(x, y), q = new Point(x, y);
doubleScale(x, y, p, q);
System.out.println( "(x,y) = " + new Point(x, y) +
" p = " + p + " q = " + q);
}
private static void doubleScale(int x, int y, Point p, Point q)
{
x *= 2;
y *= 2;
p.x *= 2;
p.y *= 2;
q = new Point(x, y);
}
}
Suppose a similar program were written in C# in which all the parameters were ref parameters. What would the output of that program be?