Java DateFormatSymbols getInstance() Example

DateFormatSymbols class getInstance() method example. This example shows you how to use getInstance() method.


Syntax is : public static final DateFormatSymbols getInstance()
Method returns the DateFormatSymbols instance for the default locale. This method provides access to DateFormatSymbols instances for locales supported by the Java runtime itself as well as for those supported by installed DateFormatSymbolsProvider implementations.

Here is the code.
/**
 * @(#) GetInstanceDateFormatSymbols.java
 * A class representing use of method getInstance() of DateFormatSymbols
class in java.text Package.
 * @Version  14-May-2008
 @author   Rose India Team
 */
import java.text.*;

class GetInstanceDateFormatSymbols {

    public static void main(String[] args) {

        // Create new DateFormatSymbols object with getInstance() method.
        DateFormatSymbols dFormatSymbols = DateFormatSymbols.getInstance();
        String[] weekDays = dFormatSymbols.getWeekdays();
        System.out.print("Week days of date format symbol : ");
        for (int i = 0; i < weekDays.length; i++) {
            System.out.println(weekDays[i]);
        }
    }
}

Output of the program.
Week days of date format symbol :
Sunday
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US