That's a pleasure but please show us the code with the Comparator. Also show us how you are initialising the ID numbers in the rental objects.
onagh grange wrote:. . . Thanks again
What Comparator? That is the first you have said about Comparators and there aren't any Comparators in the code you have shown so far. You don't use Comparators for iterating loops, but for working out whether object1 should be sorted before object2 or not. What you were doing last night was to test whether your ID was the same as one of the videos' IDs. I thought you had got that part to work. You can read about Comparators etc. in the Java™ Tutorials,, but you might not have the time to read that section just at the moment.
onagh grange wrote:. . . iterate through the loop using a comparator . . . .
No, it doesn't throw an exception; it declares it. If you have a plain simple Game object, then you must handle the exception. Come to thin kof it, you are correct; because your references are declared as Game, you must still handle the exception because the compiler cannot know whether a subclass does or doesn't declare Exception.
Carlota Vina wrote:Due to the method play() of Game throws a Exception, the main must to handle this exception(with a try-catch or with throws)
That was nothing compared to the time my daughter and I were cycling through Colchester; it started raining when we got to Westway, along Cymbeline Way, the old A12 bypass. By the time we got to North Station Road, another ¼ miles, the water was 2″ deep on the streets, and then it got really wet. By the time we got to the University of Essex about two miles further, the roads were dry and there was a blue sky.
Liutauras Vilda wrote:. . . it was raining so much that I couldn't remember anything similar
I managed to get to the station and under cover before the rain started.
. . . To my surprise he was completely dry . . ..
That doesn't look clear, but I think the answer is no.
Carlota Vina wrote:Then the order it b.getH() and after the System.out.println?