-
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
1 #2208
base: master
Are you sure you want to change the base?
1 #2208
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.
Great job on implementing the Machine
class hierarchy! 🚜 While your code has a solid foundation, there are a few key areas to address to ensure it functions correctly:
-
Syntax Errors: Ensure all
System.out.println
statements in theBulldozer
,Truck
, andExcavator
classes end with semicolons. This is crucial for the code to compile and run. -
Code Structure: The
for
loop in theMainApp
class should be placed inside a method, such as themain
method, to execute properly. -
Access Modifiers: Consider adding an access modifier to the
Machine
array inMainApp
to adhere to encapsulation principles. -
Redundant Empty Lines: Remove any unnecessary empty lines after class declarations or method signatures for cleaner code.
Your effort is commendable, and addressing these issues will enhance your understanding and coding skills. Keep up the good work, and remember to learn from these points to avoid similar issues in the future. Happy coding! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
src/main/Bulldozer.java
Outdated
public class Bulldozer extends Machine { | ||
@Override | ||
public void doWork() { | ||
System.out.println("Bulldozer started working") |
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.
There is a missing semicolon at the end of this line. Java statements must end with a semicolon.
src/main/Bulldozer.java
Outdated
} | ||
@Override | ||
public void stopWork() { | ||
System.out.println("Bulldozer stopped working") |
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.
There is a missing semicolon at the end of this line. Java statements must end with a semicolon.
src/main/Excavator.java
Outdated
public class Excavator extends Machine { | ||
@Override | ||
public void doWork() { | ||
System.out.println("Excavator started working") |
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.
There is a missing semicolon at the end of this line. Java statements must end with a semicolon.
src/main/Excavator.java
Outdated
} | ||
@Override | ||
public void stopWork() { | ||
System.out.println("Excavator stopped working") |
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.
There is a missing semicolon at the end of this line. Java statements must end with a semicolon.
src/main/Truck.java
Outdated
public class Truck extends Machine { | ||
@Override | ||
public void doWork() { | ||
System.out.println("Truck started working") |
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.
There is a missing semicolon at the end of this line. Java statements must end with a semicolon.
src/main/Truck.java
Outdated
} | ||
@Override | ||
public void stopWork() { | ||
System.out.println("Truck stopped working") |
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.
There is a missing semicolon at the end of this line. Java statements must end with a semicolon.
@@ -1,5 +1,9 @@ | |||
package core.basesyntax; | |||
|
|||
public class MainApp { | |||
|
|||
Machine[] machine = new Machine[]{new Truck(), new Bulldozer(), new Excavator()}; |
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 array declaration is correct, but the loop that follows is not properly enclosed within a method. In Java, code must be inside a method or constructor.
@@ -1,5 +1,9 @@ | |||
package core.basesyntax; | |||
|
|||
public class MainApp { | |||
|
|||
Machine[] machine = new Machine[]{new Truck(), new Bulldozer(), new Excavator()}; | |||
for (int i = 0;i < machine.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 for
loop is not inside any method or constructor. You need to place this loop inside a main
method or another method to execute it properly.
2 |
3 |
5 |
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.
Hi, this task isn't frontend course, you need to switch to another course on the platform
1