How to read properties file in java

后端 未结 2 504
予麋鹿
予麋鹿 2021-01-28 17:50

I want write a java program

Problem:

I have property file, in the property file contains

range=\"1,5,35-50,100\"
相关标签:
2条回答
  • 2021-01-28 18:18

    You can read the property file values, store them in a DataStructure lets say Array and use contains method to check if the value read from command line is contained in the array or not. Let me know in case you need any help in writing code for this or you are stuck anywhere.

    0 讨论(0)
  • 2021-01-28 18:27
    String bundle = "your properties file name without .properties";
    ResourceBundle rb = ResourceBundle.getBundle(bundle);
    String range = rb.getString("range");
    
    0 讨论(0)
提交回复
热议问题