Which of the following code is correct ?<br/><br/>a. Date date = DateFormat.newInstance(DateFormat.LONG, Locale.US).parse(str); <br/><br/>b. Date date = DateFormat.newInstance(DateFormat.LONG, Locale.US).format(str); <br/><br/>c. Date date = DateFormat.getDateInstance(DateFormat.LONG, Locale.US).parse(str);

Search Interview Questions

 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text


Interview Questions and Answers

 Q1. Which of the following code is correct ?

a. Date date = DateFormat.newInstance(DateFormat.LONG, Locale.US).parse(str);

b. Date date = DateFormat.newInstance(DateFormat.LONG, Locale.US).format(str);

c. Date date = DateFormat.getDateInstance(DateFormat.LONG, Locale.US).parse(str);
Core Java
Ans. c

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   java.util   date   dateformat

Related Questions

  If you are given a choice to implement the code to either Insert a Record or Update if already exist, Which approach will you follow ?
 Within AWS S3, Why new files are available immediately for read operation but not the updates ?
  Will this code Work ? If not , Why ?
  Is java.util.Date an abstract Class ? Is java.util.Calendar an abstract Class ?
  Which of the following code is correct ?
  What is the use of parse method in DateFormat ?
  Which of the following is not a valid NumberFormat initialization ?
  What will the following code do ?
  Name few Date and Time Classes you have used in your projects ?

Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: