package com.insightfullogic.java8.answers.chapter2;

import java.text.SimpleDateFormat;

import static java.lang.ThreadLocal.withInitial;

public class Question2 {

    public static ThreadLocal<SimpleDateFormat> formatter
            = withInitial(() -> new SimpleDateFormat("dd-MMM-yyyy"));

}

package com.insightfullogic.java8.answers.chapter2;

import java.text.SimpleDateFormat;

import static java.lang.ThreadLocal.withInitial;

public class Question2 {

     public final static ThreadLocal<DateFormatter> formatter = ThreadLocal.withInitial(() -> new DateFormatter(new SimpleDateFormat("dd-MMM-yyyy")) );
}

Update Question2.java