-
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
added class Machine, Truck, Bulldozer, Excavator and called methods d… #1563
base: master
Are you sure you want to change the base?
Conversation
package core.basesyntax; | ||
|
||
public class Bulldozer extends Machine { | ||
|
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.
mate checkstyle doesn't provide for a line after class definition, please fix everywhere
String[] Machine; | ||
String Truck = new String(); | ||
String Bulldozer = new String(); | ||
String Excavator = new String(); |
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.
why do you create strings here? Create machine array instead: new Machine[]{new Truck(), etc}
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.
Please, make sure the build passes before requesting a review (locally you can run mvn clean package)
public static void main(String[] args) { | ||
Machine[] machines = new Machine[]{new Truck(), new Bulldozer(), new Excavator()}; | ||
Machine truck = new Truck(); | ||
truck.doWork(); | ||
truck.stopWork(); | ||
|
||
Machine bulldozer = new Bulldozer(); | ||
bulldozer.doWork(); | ||
bulldozer.stopWork(); | ||
|
||
Machine excavator = new Excavator(); | ||
excavator.doWork(); | ||
excavator.stopWork(); | ||
} |
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.
try using a `for' loop for machines
public static void main(String[] args) { | |
Machine[] machines = new Machine[]{new Truck(), new Bulldozer(), new Excavator()}; | |
Machine truck = new Truck(); | |
truck.doWork(); | |
truck.stopWork(); | |
Machine bulldozer = new Bulldozer(); | |
bulldozer.doWork(); | |
bulldozer.stopWork(); | |
Machine excavator = new Excavator(); | |
excavator.doWork(); | |
excavator.stopWork(); | |
} | |
public static void main(String[] args) { | |
Machine[] machines = new Machine[]{new Truck(), new Bulldozer(), new Excavator()}; | |
// here | |
} |
…oWork, stopWork