Given below the sample code :
11 DateFormat df = DateFormat.getDateInstance();
12 Date date = new Date();
13 df.setLocale(Locale.ITALY);
14 String str = df.format(date);
15 System.out.println(str);
What will be the output of the above code?
1. current date
2. no output
3. compile error at line 13
4. current date and country name.
(3)
Wrong way of setting Locale. The method setLocale(Locale) is undefined for the type DateFormat.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.