-
What is the output of this program?
import java.text.*;
import java.util.*;
public class DateFormatting_Example
{
public static void main(String args[])
{
Date d = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("hh:mm");
System.out.print(sdf.format(d));
}
}
-
- 08:28:25
- 08
- Compilation Error
- 08:28
- Runtime Error
Correct Option: D
The code “sdf = new SimpleDateFormat(“hh:mm”);” create a SimpleDataFormat class with format hh:mm where h is hours, m is month.