File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Internationalization and Locales Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Internationalization and Locales" Watch "Internationalization and Locales" New topic
Author

Internationalization and Locales

Enkita mody
Ranch Hand

Joined: Aug 06, 2012
Posts: 333

Locale[] supportedLocales = {
Locale.FRENCH,
Locale.GERMAN,
Locale.ENGLISH
};

I'm wondering how these locale objects are created i.e Locale.FRENCH looks like enum constant not an object.


OCA7
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4240
    
    7

They're static final members of the Locale class, which are also Locale objects. That's how you used to get a similar effect to an enum before enums were introduced to the language, but in this case an enum wouldn't be any good because we also need to be able to create new Locale objects.

The source code looks something like this:
(with the object being created by the createConstant() method)
Enkita mody
Ranch Hand

Joined: Aug 06, 2012
Posts: 333

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Internationalization and Locales
 
Similar Threads
Static and gc
MessageSourceAccessor bundle of messages
Question about the day-of-week in GregorianCalendar
Calendar.getInstance(locale) not working
JOptionPane - OK and Cancel buttons