Solved

Reading property file

Posted on 2006-07-13
5
212 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
  • 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 500 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
firstswap challenge 20 77
simple java question 3 56
MySqlDump not dumping triggers 1 31
use lov values 2 50
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
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 how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

773 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