Java - Utility Classes - Interview Questions and Answers on Locale

Q1.  What is the Locale class?

Ans. The Locale class is used to tailor program output to the conventions of a particular geographic, political, or cultural region

Q2.  Which of the following is not a valid java.util.Locale initialization ?

a. new Locale ()
b. new Locale ( String language )
c. new Locale ( String language , String country )

Ans. a i.e new Locale()

Q3.  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);

Ans. c



Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner
comments powered by Disqus