Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.InputStream;
import java.io.StringBufferInputStream;
import java.util.Enumeration;
import java.util.PropertyResourceBundle;

public class Main {
    public static void main(String[] args) throws Exception {
        // Prepare content for simulating property files
        String fileContent = "s1=1\n" + "s2=Main\n" + "s3=Fri Jan 31";
        InputStream propStream = new StringBufferInputStream(fileContent);

        PropertyResourceBundle bundle = new PropertyResourceBundle(propStream);

        // Get resource keys
        Enumeration keys = bundle.getKeys();
        while (keys.hasMoreElements()) {
            System.out.println("Bundle key: " + keys.nextElement());
        }
    }

}