Question:Which of the following code snippets will take transform input string "2012/06/05" to output string "05 - 06 - 2012"? 

A 
String dateString = "2012/06/05"; 
Date date = new SimpleDateFormat("yyyy/MM/dd").parse(dateString); 
SimpleDateFormat sdf = new SimpleDateFormat("dd - MM - yyyy");
System.out.println(sdf.format(date));
 

B 
String dateString = "2012/06/05"; 
Date date = new SimpleDateFormat("yyyy/MM/dd").format(dateString); SimpleDateFormat sdf = new SimpleDateFormat("dd - MM - yyyy"); System.out.println(sdf.parse(date));
 

C 
String dateString = "2012/06/05"; 
Date date = new SimpleDateFormat("dd - MM - yyyy").format(dateString); 
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
System.out.println(sdf.parse(date));
 

D 
String dateString = "2012/06/05"; 
Date date = new SimpleDateFormat("dd - MM - yyyy").parse(dateString); 
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); 
System.out.println(sdf.format(date));
 

+ Answer
+ Report
Total Preview: 579

Copyright © 2024. Powered by Intellect Software Ltd