ResourceBundle.Control constants in Java

1. ResourceBundle.Control.FORMAT_CLASS: 

Syntax:

List<String> java.util.ResourceBundle.Control.FORMAT_CLASS

The class-only format List contains "java.class". This List is unmodifiable.

Approach

Java

import java.util.List;
import java.util.ResourceBundle.Control;

public class ResourceBundleControlFORMAT_CLASS {
    public static void main(String[] args) {

        List<String> str = Control.FORMAT_CLASS;
        System.out.println(str);
    }
}

Output:

[java.class]



2. ResourceBundle.Control.FORMAT_DEFAULT:

Syntax:

List<String> java.util.ResourceBundle.Control.FORMAT_DEFAULT

The default format List, which contains the strings "java.class" and  "java.properties", in this order. This List is unmodifiable.

Approach

Java

import java.util.List;
import java.util.ResourceBundle.Control;

public class ResourceBundleControlFORMAT_DEFAULT {
    public static void main(String[] args) {

        List<String> str = Control.FORMAT_DEFAULT;
        System.out.println(str);
    }
}

Output:

[java.class, java.properties]



3. ResourceBundle.Control.FORMAT_PROPERTIES

Syntax:

List<String> java.util.ResourceBundle.Control.FORMAT_PROPERTIES

The properties-only format List containing "java.properties". This List is unmodifiable.

Approach

Java

import java.util.List;
import java.util.ResourceBundle.Control;

public class ResourceBundleControlFORMAT_PROPERTIES {
    public static void main(String[] args) {

        List<String> str = Control.FORMAT_PROPERTIES;
        System.out.println(str);
    }
}

Output:

[java.properties]



4. ResourceBundle.Control.TTL_DONT_CACHE:

Syntax:

long java.util.ResourceBundle.Control.TTL_DONT_CACHE : -1 [0xffffffffffffffff]

The time-to-live constant for not caching loaded resource bundle instances.

Approach

Java

import java.util.ResourceBundle.Control;

public class ResourceBundleControlTTL_DONT_CACHE {
    public static void main(String[] args) {

        long str = Control.TTL_DONT_CACHE;
        System.out.println(str);
    }
}

Output:

-1



5. ResourceBundle.Control.TTL_NO_EXPIRATION_CONTROL:

Syntax:

long java.util.ResourceBundle.Control.TTL_NO_EXPIRATION_CONTROL : -2 [0xfffffffffffffffe]

The time-to-live constant for disabling the expiration control for loaded resource bundle instances in the cache.

Approach

Java

import java.util.ResourceBundle.Control;

public class ResourceBundleControlTTL_NO_EXPIRATION_CONTROL {
    public static void main(String[] args) {

        long str = Control.TTL_NO_EXPIRATION_CONTROL;
        System.out.println(str);
    }
}

Output:

-2


No comments:

Post a Comment