Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

// add a slash \ to continue the value on the next line.

prop1=line1\
line2\
line3

import java.net.URL;
import java.util.Properties;

public class Main {
  public static void main(String args[]) throws Exception {
    Properties props = new Properties();
    URL url = ClassLoader.getSystemResource("props.properties");
    props.load(url.openStream());
    System.out.println("prop1 :\n " + props.get("prop1"));
    System.out.println("prop2 :\n " + props.get("prop2"));
  }
}