Solved

For the Next Questions, Consider the Following Class Definition

Question 27

Multiple Choice

For the next questions, consider the following class definition:
public class Q
{
private int x;
public Q(int newValue)
{
x = newValue;
}
}
-If q1 and q2 are objects of Q26_27, then q1.equals(q2)


A) is a syntax error since equals is not defined in the Q26_27 class
B) is True if q1 and q2 both store the same value of x
C) is True if q1 and q2 reference the same Q26_27 object
D) is never True
E) throws a NullPointerException

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions