-
Notifications
You must be signed in to change notification settings - Fork 0
Comments
Conversation
PracticeNo1/src/main/java/Car.java
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Поля лучше пометить final, тем самым исключив возможность их модификации извне
PracticeNo1/src/main/java/Main.java
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
От хранения массива машин и лишнего цикла при определении победителя можно избавиться, если при вводе данных сразу вычислять победителя и хранить его в отдельной переменной, тогда программа будет требовать меньше памяти и работать быстрее
PracticeNo1/src/main/java/Main.java
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Сканнер лучше не создавать на каждое чтение, т.к. при создании сканнеры открывается новый входной поток, поэтому лучше 1 раз создать и переиспользовать
PracticeNo1/src/main/java/Main.java
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Минимальную и максимальную скорости лучше вынести в константы для повышения читабельности кода
No description provided.