The legacy date-time API is known to be [confusing and error-prone][1]. Since you are using Java-7, unfortunately, either you will have to live with it or you can backport the code using [modern date-time API](https://w...content-available-to-author-only...e.com/technical-resources/articles/java/jf14-date-time.html) to Java-7 using [ThreeTen-Backport][2] library.
I recommend you address the following problems with your code:
1. Never use a date-time parsing/formatting API without a `Locale`.
2. If your method can not handle an exception (i.e. can not do something to recover from the failure), it should simply throw the exception so that the calling method can get an opportunity to handle it appropriately. Therefore, using `e.printStackTrace()` in your method, `getSQLDateToString` is a bad idea. By the way, [`SimpleDateFormat#format`][3] does not throw an exception. Probably, you got confused with [`SimpleDateFormat#parse`][4] which throws `ParseException`.
Learn about the modern date-time API from **[Trail:DateTime](https://d...content-available-to-author-only...e.com/javase/tutorial/datetime/index.html)**.
Main.java:1: error: class, interface, or enum expected
The legacy date-time API is known to be [confusing and error-prone][1]. Since you are using Java-7, unfortunately, either you will have to live with it or you can backport the code using [modern date-time API](https://www.oracle.com/technical-resources/articles/java/jf14-date-time.html) to Java-7 using [ThreeTen-Backport][2] library.
^
Main.java:5: error: illegal character: '`'
1. Never use a date-time parsing/formatting API without a `Locale`.
^
Main.java:5: error: illegal character: '`'
1. Never use a date-time parsing/formatting API without a `Locale`.
^
Main.java:6: error: illegal character: '`'
2. If your method can not handle an exception (i.e. can not do something to recover from the failure), it should simply throw the exception so that the calling method can get an opportunity to handle it appropriately. Therefore, using `e.printStackTrace()` in your method, `getSQLDateToString` is a bad idea. By the way, [`SimpleDateFormat#format`][3] does not throw an exception. Probably, you got confused with [`SimpleDateFormat#parse`][4] which throws `ParseException`.
^
Main.java:6: error: illegal character: '`'
2. If your method can not handle an exception (i.e. can not do something to recover from the failure), it should simply throw the exception so that the calling method can get an opportunity to handle it appropriately. Therefore, using `e.printStackTrace()` in your method, `getSQLDateToString` is a bad idea. By the way, [`SimpleDateFormat#format`][3] does not throw an exception. Probably, you got confused with [`SimpleDateFormat#parse`][4] which throws `ParseException`.
^
Main.java:6: error: illegal character: '`'
2. If your method can not handle an exception (i.e. can not do something to recover from the failure), it should simply throw the exception so that the calling method can get an opportunity to handle it appropriately. Therefore, using `e.printStackTrace()` in your method, `getSQLDateToString` is a bad idea. By the way, [`SimpleDateFormat#format`][3] does not throw an exception. Probably, you got confused with [`SimpleDateFormat#parse`][4] which throws `ParseException`.
^
Main.java:6: error: illegal character: '`'
2. If your method can not handle an exception (i.e. can not do something to recover from the failure), it should simply throw the exception so that the calling method can get an opportunity to handle it appropriately. Therefore, using `e.printStackTrace()` in your method, `getSQLDateToString` is a bad idea. By the way, [`SimpleDateFormat#format`][3] does not throw an exception. Probably, you got confused with [`SimpleDateFormat#parse`][4] which throws `ParseException`.
^
Main.java:6: error: illegal character: '`'
2. If your method can not handle an exception (i.e. can not do something to recover from the failure), it should simply throw the exception so that the calling method can get an opportunity to handle it appropriately. Therefore, using `e.printStackTrace()` in your method, `getSQLDateToString` is a bad idea. By the way, [`SimpleDateFormat#format`][3] does not throw an exception. Probably, you got confused with [`SimpleDateFormat#parse`][4] which throws `ParseException`.
^
Main.java:6: error: illegal character: '#'
2. If your method can not handle an exception (i.e. can not do something to recover from the failure), it should simply throw the exception so that the calling method can get an opportunity to handle it appropriately. Therefore, using `e.printStackTrace()` in your method, `getSQLDateToString` is a bad idea. By the way, [`SimpleDateFormat#format`][3] does not throw an exception. Probably, you got confused with [`SimpleDateFormat#parse`][4] which throws `ParseException`.
^
Main.java:6: error: illegal character: '`'
2. If your method can not handle an exception (i.e. can not do something to recover from the failure), it should simply throw the exception so that the calling method can get an opportunity to handle it appropriately. Therefore, using `e.printStackTrace()` in your method, `getSQLDateToString` is a bad idea. By the way, [`SimpleDateFormat#format`][3] does not throw an exception. Probably, you got confused with [`SimpleDateFormat#parse`][4] which throws `ParseException`.
^
Main.java:6: error: illegal character: '`'
2. If your method can not handle an exception (i.e. can not do something to recover from the failure), it should simply throw the exception so that the calling method can get an opportunity to handle it appropriately. Therefore, using `e.printStackTrace()` in your method, `getSQLDateToString` is a bad idea. By the way, [`SimpleDateFormat#format`][3] does not throw an exception. Probably, you got confused with [`SimpleDateFormat#parse`][4] which throws `ParseException`.
^
Main.java:6: error: illegal character: '#'
2. If your method can not handle an exception (i.e. can not do something to recover from the failure), it should simply throw the exception so that the calling method can get an opportunity to handle it appropriately. Therefore, using `e.printStackTrace()` in your method, `getSQLDateToString` is a bad idea. By the way, [`SimpleDateFormat#format`][3] does not throw an exception. Probably, you got confused with [`SimpleDateFormat#parse`][4] which throws `ParseException`.
^
Main.java:6: error: illegal character: '`'
2. If your method can not handle an exception (i.e. can not do something to recover from the failure), it should simply throw the exception so that the calling method can get an opportunity to handle it appropriately. Therefore, using `e.printStackTrace()` in your method, `getSQLDateToString` is a bad idea. By the way, [`SimpleDateFormat#format`][3] does not throw an exception. Probably, you got confused with [`SimpleDateFormat#parse`][4] which throws `ParseException`.
^
Main.java:6: error: illegal character: '`'
2. If your method can not handle an exception (i.e. can not do something to recover from the failure), it should simply throw the exception so that the calling method can get an opportunity to handle it appropriately. Therefore, using `e.printStackTrace()` in your method, `getSQLDateToString` is a bad idea. By the way, [`SimpleDateFormat#format`][3] does not throw an exception. Probably, you got confused with [`SimpleDateFormat#parse`][4] which throws `ParseException`.
^
Main.java:6: error: illegal character: '`'
2. If your method can not handle an exception (i.e. can not do something to recover from the failure), it should simply throw the exception so that the calling method can get an opportunity to handle it appropriately. Therefore, using `e.printStackTrace()` in your method, `getSQLDateToString` is a bad idea. By the way, [`SimpleDateFormat#format`][3] does not throw an exception. Probably, you got confused with [`SimpleDateFormat#parse`][4] which throws `ParseException`.
^
Main.java:27: error: class, interface, or enum expected
**Output:**
^
Main.java:34: error: illegal character: '`'
Use `java.sql.Date#toLocalDate` to convert a `java.sql.Date` to `LocalDate`.
^
Main.java:34: error: illegal character: '#'
Use `java.sql.Date#toLocalDate` to convert a `java.sql.Date` to `LocalDate`.
^
Main.java:34: error: illegal character: '`'
Use `java.sql.Date#toLocalDate` to convert a `java.sql.Date` to `LocalDate`.
^
Main.java:34: error: illegal character: '`'
Use `java.sql.Date#toLocalDate` to convert a `java.sql.Date` to `LocalDate`.
^
Main.java:34: error: illegal character: '`'
Use `java.sql.Date#toLocalDate` to convert a `java.sql.Date` to `LocalDate`.
^
Main.java:34: error: illegal character: '`'
Use `java.sql.Date#toLocalDate` to convert a `java.sql.Date` to `LocalDate`.
^
Main.java:34: error: illegal character: '`'
Use `java.sql.Date#toLocalDate` to convert a `java.sql.Date` to `LocalDate`.
^
Main.java:37: error: class, interface, or enum expected
import java.time.format.DateTimeFormatter;
^
Main.java:38: error: class, interface, or enum expected
import java.util.Locale;
^
Main.java:56: error: class, interface, or enum expected
**Output:**
^
26 errors