How to convert a String to a Date object?
A.
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd");
sdf.parse(new Date());B.
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd");
sdf.format(new Date());C.
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd");
new Date().parse();D.
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd");
new Date().format();Answer: Option A
Related Questions on Data Types and Variables
Which of the following is not a valid identifier for a Java variable?
A. my_var
B. _myVar
C. 3rdVar
D. $var

Join The Discussion