Animals.java Source code

Java tutorial

Introduction

Here is the source code for Animals.java

Source

import java.util.Locale;
import java.util.ResourceBundle;
import java.util.MissingResourceException;

public class Animals {

    public static void main(String[] argv) {

        ResourceBundle animalResources;

        try {
            animalResources = ResourceBundle.getBundle("AnimalResources", Locale.getDefault());
            System.out.println(animalResources.getString("Animals"));
        } catch (MissingResourceException mre) {
            mre.printStackTrace();
        }
    }
}

//AnimalResources.properties
/*
# Sample properties file with keys whose values span more than one line
#
Animals=Cat, Dog, Giraffe, \
Shark, Dolphin, Bird, \
Bear, Moose
    
*/