message = How are you
And the java code to read it
import java.io.FileInputStream; import java.io.IOException; import java.util.Properties; public class testmain { public static void main(String[] args) { Properties props = new Properties(); try { props.load(new FileInputStream("message.properties")); String message = props.getProperty("message"); System.out.println(message); } //catch exception in case properties file does not exist catch(IOException e) { e.printStackTrace(); } } }
No comments:
Post a Comment