First try#2580
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your solution is approved with an educational note to help you progress. Great job implementing the OOP concepts correctly! Your abstract class Machine with its abstract methods, all three subclasses extending it properly, and the polymorphism in MainApp using an array of abstract references demonstrate solid understanding of inheritance and method overriding. However, there are style violations that need attention: [CHECKLIST ITEM #18] requires removing redundant empty lines after class declarations, method signatures, and method bodies in all files (Machine.java, MainApp.java, Bulldozer.java, Truck.java). Additionally, Machine.java is missing a trailing newline at the end of the file, which causes a Checkstyle NewlineAtEndOfFile error. These are formatting issues rather than logic problems, but fixing them will help your code pass CI checks and follow professional Java conventions. Keep up the good work with the functional implementation.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
| @@ -0,0 +1,9 @@ | |||
| package core.basesyntax; | |||
|
|
|||
| public abstract class Machine { | |||
There was a problem hiding this comment.
Redundant empty line after class declaration - per checklist item #18, avoid empty lines after class declarations
| @@ -1,5 +1,17 @@ | |||
| package core.basesyntax; | |||
|
|
|||
There was a problem hiding this comment.
Redundant empty line after package declaration. Per checklist #18, avoid empty lines after class declarations.
| package core.basesyntax; | ||
|
|
||
| public class MainApp { | ||
| public static void main(String[] args) { |
There was a problem hiding this comment.
Redundant empty line after class declaration. Per checklist #18, avoid empty lines after class declarations.
| public class MainApp { | ||
| public static void main(String[] args) { | ||
|
|
||
| Machine buldozerMachine = new Bulldozer(); |
There was a problem hiding this comment.
Redundant empty line after method signature. Per checklist #18, avoid empty lines after method signatures.
| Machine buldozerMachine = new Bulldozer(); | ||
| Machine truckMachine = new Truck(); | ||
| Machine excavatorMachine = new Excavator(); | ||
|
|
There was a problem hiding this comment.
Redundant empty line after method body. Per checklist #18, avoid empty lines after method signatures.
| public class MainApp { | ||
| public static void main(String[] args) { | ||
|
|
||
| Machine buldozerMachine = new Bulldozer(); |
There was a problem hiding this comment.
Redundant empty line after method signature. Per checklist #18, avoid empty lines after method signatures.
| Machine buldozerMachine = new Bulldozer(); | ||
| Machine truckMachine = new Truck(); | ||
| Machine excavatorMachine = new Excavator(); | ||
|
|
There was a problem hiding this comment.
Redundant empty line after method body. Per checklist #18, avoid empty lines after method signatures.
| @@ -1,5 +1,17 @@ | |||
| package core.basesyntax; | |||
|
|
|||
There was a problem hiding this comment.
Redundant empty line after package declaration. Per checklist #18, avoid empty lines after class declarations.
| package core.basesyntax; | ||
|
|
||
| public class MainApp { | ||
| public static void main(String[] args) { |
There was a problem hiding this comment.
Redundant empty line after class declaration. Per checklist #18, avoid empty lines after class declarations.
| public class MainApp { | ||
| public static void main(String[] args) { | ||
|
|
||
| Machine buldozerMachine = new Bulldozer(); |
There was a problem hiding this comment.
Redundant empty line after method signature. Per checklist #18, avoid empty lines after method signatures.
| Machine buldozerMachine = new Bulldozer(); | ||
| Machine truckMachine = new Truck(); | ||
| Machine excavatorMachine = new Excavator(); | ||
|
|
There was a problem hiding this comment.
Redundant empty line after method body. Per checklist #18, avoid empty lines after method signatures.
| public class MainApp { | ||
| public static void main(String[] args) { | ||
|
|
||
| Machine buldozerMachine = new Bulldozer(); |
There was a problem hiding this comment.
Redundant empty line after method signature. Per checklist #18, avoid empty lines after method signatures.
| Machine buldozerMachine = new Bulldozer(); | ||
| Machine truckMachine = new Truck(); | ||
| Machine excavatorMachine = new Excavator(); | ||
|
|
There was a problem hiding this comment.
Redundant empty line after method body. Per checklist #18, avoid empty lines after method signatures.
| @@ -1,5 +1,17 @@ | |||
| package core.basesyntax; | |||
|
|
|||
There was a problem hiding this comment.
Redundant empty line after package declaration. Per checklist #18, avoid empty lines after class declarations.
| package core.basesyntax; | ||
|
|
||
| public class MainApp { | ||
| public static void main(String[] args) { |
There was a problem hiding this comment.
Redundant empty line after class declaration. Per checklist #18, avoid empty lines after class declarations.
| public class MainApp { | ||
| public static void main(String[] args) { | ||
|
|
||
| Machine buldozerMachine = new Bulldozer(); |
There was a problem hiding this comment.
Redundant empty line after method signature. Per checklist #18, avoid empty lines after method signatures.
|
|
||
| Machine buldozerMachine = new Bulldozer(); | ||
| Machine truckMachine = new Truck(); | ||
| Machine excavatorMachine = new Excavator(); |
There was a problem hiding this comment.
Redundant empty line after method body. Per checklist #18, avoid empty lines after method signatures.
| public class MainApp { | ||
| public static void main(String[] args) { | ||
|
|
||
| Machine buldozerMachine = new Bulldozer(); |
There was a problem hiding this comment.
Redundant empty line after method signature. Per checklist #18, avoid empty lines after method signatures.
|
|
||
| Machine buldozerMachine = new Bulldozer(); | ||
| Machine truckMachine = new Truck(); | ||
| Machine excavatorMachine = new Excavator(); |
There was a problem hiding this comment.
Redundant empty line after method body. Per checklist #18, avoid empty lines after method signatures.
|
|
||
| public class Bulldozer extends Machine { | ||
|
|
There was a problem hiding this comment.
This violates checklist item #18: redundant empty line after class declaration. Remove the empty line between public abstract class Machine { and the method.
| public class Bulldozer extends Machine { | ||
|
|
||
| @Override | ||
| public void doWork() { |
There was a problem hiding this comment.
This violates checklist item #18: redundant empty line after public abstract void doWork();. Remove this empty line.
|
|
||
| public class Bulldozer extends Machine { | ||
|
|
There was a problem hiding this comment.
This violates checklist item #18: redundant empty line after class declaration. Remove the empty line between public class Bulldozer extends Machine { and the method.
| @Override | ||
| public void doWork() { | ||
| System.out.println("Bulldozer started its work"); | ||
| } |
There was a problem hiding this comment.
This violates checklist item #18: redundant empty line after method closing brace }. Remove this empty line.
|
|
||
| public class Bulldozer extends Machine { | ||
|
|
There was a problem hiding this comment.
This violates checklist item #18: redundant empty line after class declaration. Remove the empty line between public class Excavator extends Machine { and the method.
| @Override | ||
| public void doWork() { | ||
| System.out.println("Bulldozer started its work"); | ||
| } |
There was a problem hiding this comment.
This violates checklist item #18: redundant empty line after method closing brace }. Remove this empty line.
|
|
||
| public class Bulldozer extends Machine { | ||
|
|
||
| @Override |
There was a problem hiding this comment.
This violates checklist item #18: redundant empty line after public static void main(String[] args) {. Remove this empty line.
|
|
||
| @Override | ||
| public void stopWork() { |
There was a problem hiding this comment.
This violates checklist item #18: redundant empty lines after variable declarations. Remove empty lines on lines 9 and 11.
| @@ -0,0 +1,14 @@ | |||
| package core.basesyntax; | |||
|
|
|||
There was a problem hiding this comment.
Redundant empty line after package declaration. Per checklist #18, avoid empty lines after class declarations.
| package core.basesyntax; | ||
|
|
||
| public class Truck extends Machine { | ||
|
|
There was a problem hiding this comment.
Redundant empty line after class declaration. Per checklist #18, avoid empty lines after class declarations.
| @Override | ||
| public void doWork() { | ||
| System.out.println("Truck started its work"); | ||
| } |
There was a problem hiding this comment.
Redundant empty line after method body. Per checklist #18, avoid empty lines after method signatures.
| public void doWork() { | ||
| System.out.println("Truck started its work"); | ||
| } | ||
|
|
There was a problem hiding this comment.
Redundant empty line before second method. Per checklist #18, avoid empty lines after method signatures.
No description provided.