Details of this Paper

generic stack

Description

solution


Question

Open the project named ch08_ex4_EqualsTest in the ex_starts directory. This application creates and compares two Product objects and two LineItem objects using the equals method. Review this code to see how it works.;Run the project. Since the equals method isn't overridden in the Product or LineItem class, the output from this application should indicate that the comparisons are based on object references and not the data the objects contain.;Open the Product class, and add an equals method like the one shown in figure 8-15. Then, run the project again. This time, the output should indicate that the products are being compared based on their data and not their references.;Repeat step 3 for the LineItem class. This time, the comparisons for both the products and line items should be based on their data.

 

Paper#66337 | Written in 18-Jul-2015

Price : $32
SiteLock