Skip to content

Conversation

@SteffenLm
Copy link
Contributor

No description provided.

SteffenLm and others added 5 commits August 19, 2023 14:20
* Update SchoolClass.java

In the loop condition, pupils.size() is re-evaluated in each iteration, and because the code removed pupils from the list inside the loop, the size of the list decreases with each iteration. This is not clean and because of this an exception occurred when trying to run the function with an even amount of pupils. 

Furthermore the if condition to check if the size of the array is 1 needed also to be inside the loop for this solution.

* Update Exercise.java

Add example for even pupils

* Use while loop

---------

Co-authored-by: SteffenLm <33038091+SteffenLm@users.noreply.github.com>
@SteffenLm SteffenLm closed this Dec 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants