Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

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

        Properties prop = new Properties();

        prop.setProperty("A", "t@h.com");
        prop.setProperty("B", "k@h.com");
        prop.setProperty("C", "R@h.com");
        prop.setProperty("D", "S@h.com");

        HashMap<String, String> propMap = new HashMap<String, String>((Map) prop);

        Set<Map.Entry<String, String>> propSet;
        propSet = propMap.entrySet();

        System.out.println("Contents of map: ");
        for (Map.Entry<String, String> me : propSet) {
            System.out.print(me.getKey() + ": ");
            System.out.println(me.getValue());
        }
    }
}