Ganesh Patekar wrote:import java.time.*; imports types which are in the package java.time but class DateTimeFormatter is in the package java.time.format so you need to import DateTimeFormatter from It like
Thanks a lot Ganesh Patekar
So,if we have to use a wild card ,then it is like that
3 Errors :can not find the symbol DateTimeFormatter
Error is clearly saying you didn't import the package where DateTimeFormatter is available in your program.
You imported only java.time package. But DateTimeFormatter is not available in java.time package. It is in java.time.format package . Just add the below line in your import section
. It works fine.
I want to add one more point. If you import like java.time.*; , Java imports only classes, interfaces,etc in java.time package only. Java doesn't import classes, interfaces,etc in sub packages of java.time package.