Q:

What will be the output of the following code?

0

What will be the output of the following code?

import java.awt.Point;
class Testing
{
 public static void main(String[] args)
 {
  Point p1,p2;
  p1=new Point(100,100);
  p2=p1;
  p1.x=200;
  p1.y=200;
  System.out.println(“Point 1: ” + p1.x + ”, “ + p1.y);
  System.out.println(“Point 2: ” + p2.x + ”, “ + p2.y);
 }
}

  1. Point 1: 100, 100 Point 2: 200,200
  2. Point 1: 200, 200 Point 2: 100,100
  3. Point 1: 100, 100 Point 2: 100,100
  4. Point 1: 200, 200
    Point 2: 200,200

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

 (d).Point 1: 200, 200
Point 2: 200,200

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now