Solved

Reading property file

Posted on 2006-07-13
5
228 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 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Facing this issue for maven proxy setting 2 45
Running JavaFX on the Raspberry Pi 27 299
junit example issue 2 59
junit initializtion error 2 22
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
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 …
Suggested Courses

752 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