-
Notifications
You must be signed in to change notification settings - Fork 0
Проект 1 #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
src/main/java/Main.java
Outdated
|
|
||
| public static void Res(double price) | ||
| { | ||
| String res = "Цена для каждого: %.2f %s"; |
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.
Старайся сразу писать полные имена переменных. Это важно, потому что приложения, которые в конечном итоге ты будешь писать - будут состоять из 100 или из 1000 или даже из 10000 различных классов и просто невозможно запомнить все эти сокращения, которые кто-то выдумал, пока писал какой-либо из классов и читать такой код в разы сложнее
src/main/java/Main.java
Outdated
| public class Main { | ||
| public static void main(String[] args) { | ||
| System.out.println("Hello world!"); | ||
| Scanner scan = new Scanner(System.in); |
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.
после использования сканера хорошей практикой будет закрыть его с помощью функции scanner.close(), это позволит избежать возможных утечек памяти
src/main/java/Main.java
Outdated
|
|
||
| } | ||
|
|
||
| public static void Res(double price) |
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