如何在java中读取属性文件 [英] How to read properties file in java
问题描述
我想写一个java程序
I want write a java program
问题:
我有属性文件,在属性文件中包含
I have property file, in the property file contains
range="1,5,35-50,100"
我应该从命令提示符或JSP获取输入范围并输出消息,如这是一个范围
或这不是范围
I should get the input as range from command prompt or JSP and print out message likes this is a range
or this is not a range
让我们考虑以下I / O应该是看起来喜欢
let us consider following I/O should be looks like
Input:1
Output:this is a range
Input:2
Output:this is not a range
Input:37
Output:this is a range
Input:60
Output:this is not a range
Input:100
Output:this is a range
任何人都可以帮助我,感谢前进
can anybody help me, advance in thanks
推荐答案
您可以读取属性文件值,将它们存储在DataStructure中说Array并使用包含
方法来检查从命令读取的值line是否包含在数组中。如果您在编写代码时需要任何帮助,或者您被困在任何地方,请告诉我。
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.
这篇关于如何在java中读取属性文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!