Reading property file

Posted on 2006-07-13
Last Modified: 2010-03-31
I have a property 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 ("")) );
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:)            
Question by:atwork2003
  • 3
LVL 86

Expert Comment

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

Accepted Solution

CEHJ earned 500 total points
ID: 17102591

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

Expert Comment

ID: 17102595
try like this:

Author Comment

ID: 17102862
Works. Great...Thanks:-)
LVL 86

Expert Comment

ID: 17103218

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
AWS and Java and Rest - newbie question (Is this an authentication issue) 4 68
eclipse formatting 6 73
difference of if loops 23 43
java jdbc batch example 8 23
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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
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 …

861 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now