Skip to content

Init commit - #1

Open
aleksey2909 wants to merge 2 commits into
mainfrom
dev
Open

aleksey2909 wants to merge 2 commits into
mainfrom
dev

Conversation

@aleksey2909

Copy link
Copy Markdown
Owner

No description provided.

Comment thread src/main/java/Car.java
Comment on lines +2 to +3
String modelCar;
int speed;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Поля лучше пометить final, тем самым исключив возможность их модификации извне

Comment thread src/main/java/Main.java
System.out.println("Hello world!");
Scanner scanner = new Scanner(System.in);
Race race = new Race();
ArrayList<Car> cars = new ArrayList<>();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

От хранения массива машин и лишнего цикла при определении победителя можно избавиться, если при вводе данных сразу вычислять победителя и хранить его в отдельной переменной, тогда программа будет требовать меньше памяти и работать быстрее

Comment thread src/main/java/Race.java
@@ -0,0 +1,10 @@
import java.util.ArrayList;

public class Race {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Логику с определением победителя лучше в этот класс перенести из Main, т.к. функциональность определения победителя больше к классу Race относится

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