-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
. #1610
base: master
Are you sure you want to change the base?
. #1610
Conversation
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.
Your implementation of the WorkWithFile
class is mostly correct and meets the core requirements of the task. 🎉 While there are a few areas for improvement, such as using StringBuilder
for concatenation, declaring constants for repeated strings, and refining exception handling, these are minor issues that do not critically impact the functionality of your code. Keep up the great work, and consider these suggestions for future enhancements to improve code readability and maintainability! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
int buy = 0; | ||
|
||
try (BufferedReader reader = Files.newBufferedReader(Paths.get(fromFileName))) { | ||
String line = " "; |
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.
The initialization of the line
variable with a space (" "
) is unnecessary. It can be initialized as an empty string (""
) or simply declared without initialization, as it will be immediately overwritten by reader.readLine()
.
writer.newLine(); | ||
writer.write("result," + result); | ||
} catch (IOException e) { | ||
System.err.println("Error writing to the file: " + e.getMessage()); |
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.
Using System.err.println
for error handling is not ideal for production code. Consider throwing an exception or using a logging framework to handle errors more gracefully.
No description provided.