where do you use static block in framework code example
Example: where do you use static block in framework
Static Block:
I use static block in DBUtilities class. See below...
static {
try {
connection = DriverManager.getConnection(url, username, password);
statement = connection.createStatement();
metadata = connection.getMetaData();
}catch(Exception e) { }
e.printStackTrace();
}
And I also use static block in ConfigurationReader
class. By using static block, as soon as
Configuration class is loaded I will be able to
get the path and connect to the properties file,
ready to retrieve the desired value from
properties file using get method.