Skip to content

Conversation

@rogovas1
Copy link
Owner

@rogovas1 rogovas1 commented Oct 9, 2025

No description provided.

while (true) {
System.out.println("Скорость автомобиля от 0 до 250 км/ч");
speed = scanner.nextInt();
if (speed > 0 && speed <= 250) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Минимальную и максимальную скорости лучше вынести в константы для повышения читабельности кода

int speed;
while (true) {
System.out.println("Скорость автомобиля от 0 до 250 км/ч");
speed = scanner.nextInt();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Здесь при вводе символов вместо числа будет выброшен эксепшн, который нигде не обрабатывается

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