Posts

Showing posts with the label reading properties from file

Reading properties from a file with example

Reading properties from file, find list of files in a directory and find a year is leap year or not. These all example present in this post. Read properties from file:           Reading properties from properties(.properties) file is the major requirement in real-time applications. Here, we will come to know, how to read properties from file with an example explanation.           We will create one .properties file with the name of javaex.properties under src package and we will declare roleId's as key-value pairs. Like below, application.id.roleIds = ' 53 ',' 121 ',' 63 ',' 46 ',' 43 ',' 71 ',' 45 ',' 36 ',' 64 '           Here, application.id.roleIds is the Key to get the values, which  we will use in java class. The below program explains you how to read data from the properties file by using the key which you have declared in properties file. package com.javatbrains.