The LocalDate class has a parse method. You can use this to convert a String to a LocalDate. So, this code simply invokes the parse method with the String date object. It prints the following output: 2015-06-12.
The following code demonstrates this:
The LocalDate.parse() method requires the String date to be in the yyyy-MM-dd format. If the String date is in some other format, this method throws an Exception. There is an overloaded version of the parse method that can be used for such scenarios as explained in the next section.