Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Reading property file

Posted on 2006-07-13
5
Medium Priority
?
237 Views
Last Modified: 2010-03-31
Hello
I have a property file:

PROP FILE:
Strength = Medium
Day = Thursday

------
I used the following code to read the property file
Properties props = new Properties();
            props.load( fis= new FileInputStream (new File ("file.properties")) );
---------
I just need to check if the "Strength" attribute in properties file is equal to "Medium" (java) and "Day" is equal to "Thursday", How do I check this using java code.

Thank you (Urgent response requested:)            
0
Comment
Question by:atwork2003
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 17102585
if ("Medium".equals(props.getProperty("Strength")) {
}
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 2000 total points
ID: 17102591
Typo

if ("Medium".equals(props.getProperty("Strength"))) {
}
0
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 17102595
try like this:
"Thursday".equals(props.getProperty("Day"));
0
 

Author Comment

by:atwork2003
ID: 17102862
Works. Great...Thanks:-)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17103218
:-)
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses

664 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question