Skip to content

Created classes and main task has passed mvn clean package#2592

Open
acidden wants to merge 3 commits into
mate-academy:masterfrom
acidden:master
Open

Created classes and main task has passed mvn clean package#2592
acidden wants to merge 3 commits into
mate-academy:masterfrom
acidden:master

Conversation

@acidden

@acidden acidden commented May 12, 2026

Copy link
Copy Markdown

No description provided.

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

Your implementation successfully fulfills all core functional requirements for the OOP inheritance task. The abstract Machine class with its three subclasses (Truck, Bulldozer, Excavator) is correctly structured, polymorphism is properly implemented with the Machine array, and all method overrides output informative English messages as required. The code compiles and runs correctly with expected output. While there are some style improvements that could be made - such as removing redundant empty lines (checklist item #1) and changing the Machine constructor from public to protected (checklist item #4) - these are non-blocking style violations rather than critical functional issues. The linter will provide feedback on formatting, so focus on understanding why the constructor visibility matters for abstract classes as a learning opportunity. Well done on meeting all the core requirements!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

@@ -1,5 +1,12 @@
package core.basesyntax;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line after package declaration - violates checklist item #1

package core.basesyntax;

public class MainApp {
public static void main(String[] args) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line after class declaration - violates checklist item #1


Machine[] machines = new Machine[]{new Truck(), new Bulldozer(), new Excavator()};
for (Machine machine : machines) {
machine.doWork();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line after method body - violates checklist item #1

Machine[] machines = new Machine[]{new Truck(), new Bulldozer(), new Excavator()};
for (Machine machine : machines) {
machine.doWork();
machine.stopWork();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line before second method - violates checklist item #1

package core.basesyntax;

public class Bulldozer extends Machine {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line after class declaration - violates checklist item #1


public class Excavator extends Machine {

@Override

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The constructor should be protected instead of public. Abstract classes cannot be instantiated directly, so a public constructor is misleading. Using protected is the standard practice for abstract class constructors.

@@ -0,0 +1,14 @@
package core.basesyntax;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line after package declaration - violates checklist item #1

package core.basesyntax;

public class Truck extends Machine {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line after class declaration - violates checklist item #1

@Override
public void doWork() {
System.out.println("Truck starting working");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line after method body - violates checklist item #1

public void doWork() {
System.out.println("Truck starting working");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant empty line before second method - violates checklist item #1

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry, the pull request review was unsuccessful for the following reasons:

Warning

No changes were made in the pull request since the last review. Please make sure that you have added files to the pull request and committed the changes.
[CODE: NCM]

If the issue is within your control, please address it.
The next review attempt will automatically launch in about 1 hour.
If you believe this is an error or need assistance, please contact the support team.

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

Your implementation successfully fulfills all core functional requirements for the OOP inheritance task. The abstract Machine class with its three subclasses (Truck, Bulldozer, Excavator) is correctly structured, polymorphism is properly implemented with the Machine array in MainApp, and all method overrides output informative English messages as expected. The issues identified in the review are minor style concerns rather than functional blockers. The redundant empty lines mentioned in Machine.java and Truck.java are formatting issues that don't affect code functionality. Similarly, the constructor visibility suggestions (changing public to protected for abstract class constructors) represent better encapsulation practices but don't prevent the code from working correctly. The code compiles and runs as intended with proper output. Your solution demonstrates a solid understanding of Java inheritance, abstract classes, and polymorphism.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

@@ -0,0 +1,11 @@
package core.basesyntax;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item #1 violation: Redundant empty line after package declaration. Remove this empty line.

package core.basesyntax;

public abstract class Machine {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item #1 violation: Redundant empty line after class declaration. Remove this empty line.

public Machine() {
}

public abstract void doWork();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item #1 violation: Redundant empty line after method body. Remove this empty line.

}

public abstract void doWork();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item #1 violation: Redundant empty line before @OverRide annotation. Remove this empty line.

public class MainApp {

public static void main(String[] args) {
Machine[] machines = new Machine[]{new Truck(), new Bulldozer(), new Excavator()};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The Machine constructor is public, but for an abstract class, consider using protected instead. This better reflects that Machine is an abstraction only meant to be extended by subclasses, not instantiated directly.


public class Excavator extends Machine {

@Override

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item #4: This constructor should be protected instead of public. Abstract class constructors are only meant to be called by subclasses during instantiation, so protected better reflects this intent and improves encapsulation.

@@ -0,0 +1,14 @@
package core.basesyntax;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item #1 violation: Redundant empty line after package declaration. Remove this empty line.

package core.basesyntax;

public class Truck extends Machine {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item #1 violation: Redundant empty line after class declaration. Remove this empty line.

@Override
public void doWork() {
System.out.println("Truck starting working");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item #1 violation: Redundant empty line after method body. Remove this empty line.

public void doWork() {
System.out.println("Truck starting working");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item #1 violation: Redundant empty line before @OverRide annotation. Remove this empty line.

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.

2 participants