Created
February 24, 2015 22:13
-
-
Save LNA/c6f662ffeae9ea3d36f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private class CarBuilder { | |
private int year; | |
private String make; | |
public CarBuilder setYear(int year) { | |
this.year = year; | |
return this; | |
} | |
public CarBuilder setMake(String make) { | |
this.make = make; | |
return this; | |
} | |
public Car build() { | |
return new Car(year, make); | |
} | |
} | |
private class Car { | |
private final String make; | |
private final int year; | |
public Car(int year, String make) { | |
this.year = year; | |
this.make = make; | |
} | |
}*/ | |
/* Car car = new CarBuilder() | |
.setYear(2012) | |
.setMake("Honda") | |
.build();*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment