Question
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);
}
}
a.
Point 1: 100, 100
Point 2: 200,200
b.
Point 1: 200, 200
Point 2: 100,100
c.
Point 1: 100, 100
Point 2: 100,100
d.
Point 1: 200, 200
Point 2: 200,200
Posted under Object Oriented Programming
Point 2: 200,200
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What will be the output of the following code?
Similar Questions
Discover Related MCQs
Q. Is there any explicit use of pointers in java that would be applicable to objects?
View solution
Q. Can a super class object give reference to a subclass method?
View solution
Q. If a reference variable is declared final then, _________________
View solution
Q. Which of the members are referred by this pointer usually (Java)?
View solution
Q. How to refer to method of nested class?
View solution
Q. How many objects can be referenced from same variables?
View solution
Q. Java handles memory dynamically and references are deleted as soon as they are out of scope.
View solution
Q. Invoking a method on a particular object is ____________ sending a message to that object.
View solution
Q. Can reference to an object be returned from a method?
View solution
Q. What does memory allocation for objects mean?
View solution
Q. Where is the memory allocated for the objects?
View solution
Q. When is the memory allocated for an object?
View solution
Q. Using new is type safe as _______________________
View solution
Q. Which of the following function can be used for dynamic memory allocation of objects?
View solution
Q. Which keyword among the following can be used to declare an array of objects in java?
View solution
Q. When is the memory allocated for an object gets free?
View solution
Q. Which among the following keyword can be used to free the allocated memory for an object?
View solution
Q. Which function is called whenever an object goes out of scope?
View solution
Q. Which operator can be used to check the size of an object?
View solution
Q. The memory allocated for an object ____________________
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Object Oriented Programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!