0

I want write a java program

Problem:

I have property file, in the property file contains

range="1,5,35-50,100"

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

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

1
  • 3
    Accept answers to your questions by clicking the "check" by the correct solution. 19 questions with no accepted answers is not a good way to encourage people to help you... Commented Mar 14, 2011 at 5:45

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

i have only property file. and output will be looks likes as i was mentioned, i don't know how to write a program. so please give ur idea/logic
@Ganesamoorthy - No, people aren't going to do your work for you.
0
String bundle = "your properties file name without .properties";
ResourceBundle rb = ResourceBundle.getBundle(bundle);
String range = rb.getString("range");

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.