-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Oop basics #2212
base: master
Are you sure you want to change the base?
Oop basics #2212
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.
Hello! 😊 You've done a great job implementing the classes and their methods. However, there are a couple of critical issues in the MainApp
class that need to be addressed before we can approve the pull request:
-
Method Name Typo: The method name
mail
should be corrected tomain
to ensure it serves as the entry point of the application. -
Loop Condition Error: The loop condition
i <= machines.length
should be changed toi < machines.length
to prevent anArrayIndexOutOfBoundsException
.
Once these issues are resolved, your code will be in great shape! Keep up the good work, and don't hesitate to reach out if you need any help. 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
🔄 Fix the issues, commit the changes, and then re-request my review using the Re-request review
button in the Reviewers tab.
@@ -2,4 +2,13 @@ | |||
|
|||
public class MainApp { | |||
|
|||
public static void mail (String[] args) { |
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 method name mail
seems to be a typo. It should be main
to serve as the entry point of the application.
Machine [] machines = new Machine[] { | ||
new Truck(), new Bulldozer(), new Excavator() | ||
}; | ||
for (int i = 0; i <= machines.length; i++) { |
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 loop condition i <= machines.length
should be i < machines.length
to prevent an ArrayIndexOutOfBoundsException
. The current condition will attempt to access an index equal to machines.length
, which is out of bounds.
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.
Great job on implementing the task requirements! 🎉 Your code meets the specifications, with the MainApp
class correctly set up as the entry point and the loop condition properly implemented to avoid errors. The Machine
class is well-structured as an abstract class, and the Truck
, Bulldozer
, and Excavator
classes correctly extend it, overriding the necessary methods.
While there are no critical issues, always remember to review the comments for potential improvements. This will help you refine your skills and avoid similar issues in future projects. Keep up the good work and continue learning from each experience! 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
No description provided.