Answers for "where do you use static block in framework"

0

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.
Posted by: Guest on January-15-2021

Code answers related to "where do you use static block in framework"

Browse Popular Code Answers by Language