Reputation: 634
I'm using the following convention and in date I get that method is deprecated (there is line that delete the date)
there is saw this message Deprecated. As of JDK version 1.1, replaced by DateFormat.parse(String s)
.
how should i use it in the following code?
else if (typeName.equals("String")) {
return new SwitchInputType<String>(new String("String test"));
}
else if (typeName.equals("Date")) {
return new SwitchInputType<Date>(new -Date-("13:20:00"));
}
the problem is with the (new Date("13:20:00"));
when i try to replace it with
return new SwitchInputType<DateFormat>(new DateFormat("13:20:00"));
i got the following message :
Cannot instantiate the type DateFormat
how should I handle it?
Upvotes: 2
Views: 2067
Reputation: 32391
DateFormat
is an abstract class so it cannot be instantiated. Instantiate a SimpleDateFormat
instead or use the static methods in DateFormat
like getDateInstance()
or getTimeInstance()
.
Upvotes: 2