# Constructors 33
* What does it mean to create an instance in an unknown state?
* Why shouldn't you do that?
* What is a null pointer Exception?
<https://www.youtube.com/watch?v=MSzVHnG-zyU>
# Chaining Constructors 34
* What are the advantages of chaining constructors?
* What does the this() keyword do?
* How do you call a constructor from a super class?
<https://www.youtube.com/watch?v=m6t8z3CWskA>
# Patterns: The Builder Pattern 35
* What is a design pattern?
* How many Java design patterns are there?
* What are the advantages of using a design pattern?
<https://www.youtube.com/watch?v=mFCk31FoUg4>
# Builder Example
```java
package builderexample;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.InputMismatchException;
/**
*
* @author aballantyne
*/
public class Customer {
private String surname;
private String forename;
private int balance;
private LocalDate due;
public static class CustomerBuilder {
private String surname;
private String forename;
private int balance;
private LocalDate due;
public CustomerBuilder surname(String surname) {
this.surname = surname;
return this;
}
public CustomerBuilder forename(String forename) {
this.forename = forename;
return this;
}
public CustomerBuilder balance(int balance) {
this.balance = balance;
return this;
}
public CustomerBuilder due(String due) {
DateTimeFormatter dateInput = DateTimeFormatter.ofPattern("yyyy-MM-dd");
//Now parse that String
this.due = LocalDate.parse(due, dateInput);
return this;
}
public Customer build() {
Customer customer = new Customer();
customer.surname = this.surname;
customer.forename = this.forename;
customer.balance = this.balance;
customer.due = this.due;
return customer;
}
}
private Customer() {
}
}
public class BuilderExample {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Customer customer = new Customer.CustomerBuilder()
.surname("bloggs")
.forename("Joe")
.due("2021-03-14")
.balance(4000)
.build();
}
}
```