<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Uncategorized Archives | Selenium Webdriver Appium Complete Tutorial</title>
	<atom:link href="https://automationtesting.in/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>https://automationtesting.in/category/uncategorized/</link>
	<description>Automation Testing</description>
	<lastBuildDate>Wed, 27 Nov 2019 08:22:43 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.2.2</generator>
	<item>
		<title>How to Read Data From Properties File in Java</title>
		<link>https://automationtesting.in/how-to-read-data-from-properties-file-in-java/</link>
					<comments>https://automationtesting.in/how-to-read-data-from-properties-file-in-java/#respond</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Wed, 27 Nov 2019 08:13:30 +0000</pubDate>
				<category><![CDATA[Java IQs]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[How to Read Data from properties file]]></category>
		<category><![CDATA[Read Data from Properties file]]></category>
		<category><![CDATA[Read Data from Properties file in java]]></category>
		<guid isPermaLink="false">http://automationtesting.in/?p=2311</guid>

					<description><![CDATA[<p>In this blog, we will see How to Read Data From Properties File in Java. This will be asked in the most of the interview questions. Things to Remember: Mostly, the properties file is used to maintain the configurable parameters of the project. Extension for this file is &#8220;.properties&#8221; Properties file data will be in [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://automationtesting.in/how-to-read-data-from-properties-file-in-java/">How to Read Data From Properties File in Java</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img src='http://automationtesting.in/wp-content/uploads/2019/11/How-to-Read-Properties-file-in-Java.png'></p><p><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<p>In this blog, we will see How to Read Data From Properties File in Java. This will be asked in the most of the interview questions.</p>
<p><strong>Things to Remember:</strong></p>
<ol>
<li>Mostly, the properties file is used to maintain the configurable parameters of the project.</li>
<li>Extension for this file is &#8220;.properties&#8221;</li>
<li>Properties file data will be in a Key and Value pair format.</li>
<li>whenever you&#8217;re creating a properties file, maintain the keys in unique format. Don&#8217;t use the existing key for your new value.
<ul>
<li>If you use the existing key again, then whenever control searches for that key it will return the last searched value. This might leads to conflicts.</li>
</ul>
</li>
</ol>
<pre class="brush: java; title: ; notranslate">
#CONFIG File
username = Username
password = pass
firstname = fname
</pre>
<div class="post-video"><iframe loading="lazy" title="6.  How to Read Data From Properties File in Java | Properties File | Java Interview Questions" width="1165" height="874" src="https://www.youtube.com/embed/OBnjTszNe3c?wmode=transparent&#038;fs=1"  allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></div>
<p><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
In the below snippet, we have done the following to Read Data from properties file:</p>
<ol>
<li>Created a new folder under our project and created  a new properties file with some data</li>
<li>Created a object and assigned the file location of this newly created properties file using FileInputStream class.</li>
<li>Created a object for the Properties class.</li>
<li>Loaded all the properties of our file using Properties.load() method.</li>
<li>Using .getProperty() method, we can load all our data using Key as a parameter.</li>
<li>Then, it prints the corresponding value of that key.</li>
</ol>
<pre class="brush: java; title: ; notranslate">
package Javaprograms;

import java.io.FileInputStream;
import java.util.Properties;

public class ReadDataFromPropertiesFile {

	public static void main(String&#x5B;] args) throws Exception {
		FileInputStream fis = new FileInputStream(&amp;quot;E:/Selenium/SeleniumPrgrms/resources/config.properties&amp;quot;);
		Properties prop = new Properties();
		
		prop.load(fis);
		
		String user = prop.getProperty(&amp;quot;username&amp;quot;);
		String pword = prop.getProperty(&amp;quot;password&amp;quot;);
		String fname = prop.getProperty(&amp;quot;firstname&amp;quot;);
		
		System.out.println(user);
		System.out.println(pword);
		System.out.println(fname);
	}

}
</pre>
<pre class="brush: java; title: ; notranslate">
Output:
--------
username = Username
password = pass
firstname = fname
</pre>
<p><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
<a href="https://www.youtube.com/watch?v=OBnjTszNe3c">Please watch the Youtube video for better understanding.</a><br />
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<div id="themify_builder_content-2311" data-postid="2311" class="themify_builder_content themify_builder_content-2311 themify_builder themify_builder_front">

	</div>
<!-- /themify_builder_content --><p>The post <a rel="nofollow" href="https://automationtesting.in/how-to-read-data-from-properties-file-in-java/">How to Read Data From Properties File in Java</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://automationtesting.in/how-to-read-data-from-properties-file-in-java/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
