Question: Look at the following code. (You might want to review the Stock class presented earlier in this chapter.) Stock stock1 = new Stock(XYZ, 9.65); Stock

Look at the following code. (You might want to review the Stock class presented earlier in this chapter.) 

Stock stock1 = new Stock("XYZ", 9.65);
Stock stock2 = new Stock("SUNW", 7.92);

While the equals method is executing as a result of the following statement, what object does this reference?

If (stock2.equals(stock1))
 System.out.println("The stocks are the same."); 

Step by Step Solution

3.49 Rating (162 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Answer This would refer to the Stock object that c... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Starting Out With Java From Control Structures Questions!