This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
Below please find my problem! I have been diligently working through Kathy and Bert's Cert book, 1.5, after diligently working through 1.4!
Current environment is 1.4; IDE is Eclipse with WOLips, a WebObjects (Apple) based environment.
When the code below runs, it blows at the search, the stackTrace points to the compareTo method in the SMU Class: ClassCastException on the line I starred.
The compareTo method resides in SMU. The ArrayList contains LocationSoilSeries objects. LocationSoilSeries extends SMU. Both classes listed below.
notes: 1 Another method calls GetData after Validate has been instantiated. 2 The Sort seems to work. I have other test code to print the list before and after the sort. 3 Originally I was using Comparators. I would like to sort and search by several properties. But the problem first appeared then, so I simplified.
Please use code tags round your quoted code; they make it easier to read. Please tell us which line the class cast exception occurs on. You should be able to work that out by reading the stack trace which prints out on screen.