Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/main/java/core/basesyntax/Bulldozer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package core.basesyntax;

public class Bulldozer 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.

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

public 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.

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

System.out.println("Bulldozer 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 declaration - violates checklist item #1

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 declaration - violates checklist item #1

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 signature - violates checklist item #1


@Override
public void stopWork() {
System.out.println("Bulldozer has stopped working");
}
}
14 changes: 14 additions & 0 deletions src/main/java/core/basesyntax/Excavator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package core.basesyntax;

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.

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.

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

@Override
public void stopWork() {
System.out.println("Excavator has stopped working");
}
}
11 changes: 11 additions & 0 deletions src/main/java/core/basesyntax/Machine.java
Original file line number Diff line number Diff line change
@@ -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.

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.


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 abstract void stopWork();
}
8 changes: 7 additions & 1 deletion src/main/java/core/basesyntax/MainApp.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
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()};

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.

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.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

}
}
}
14 changes: 14 additions & 0 deletions src/main/java/core/basesyntax/Truck.java
Original file line number Diff line number Diff line change
@@ -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.

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.

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

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.


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.

@Override
public void stopWork() {
System.out.println("Truck has stopped working");
}
}
Loading