Java Static Initialization vs. Instance Initialization – When to use which?

Static Initialization Typically static initialization block is used to initialize static variables of a class. The block is called at the time of class initialization. It is called only once. You can initialize static variables inline. If more complicated logic is required for initialization, a static initialization block can be used. The static initialization blocks … Continue reading Java Static Initialization vs. Instance Initialization – When to use which?

Managing Multiple Github Accounts from a single machine

Recently, I ran into a situation where I needed to manage multiple Github accounts from a single computer. I have two github account, one related to work and the other for my personal repositories.It is a very simple combination of ssh and git config. Before I start explaining the steps for the same, let me … Continue reading Managing Multiple Github Accounts from a single machine

Immutability in Java – What it takes to build an immutable class

Immutability means something that cannot be changed. In java an immutable class is one whose state cannot be changed once it has been created. This post aims to give a guideline on how to make a class immutable. The post contains an example of creating an immutable class.The complete code is available on Github The … Continue reading Immutability in Java – What it takes to build an immutable class

Getting Started with TestNG

TestNG is a testing framework which, inspired by JUnit and NUnit, but introduces things like dependency testing, grouping concept to make testing more powerful and easier to do. It is designed to cover all categories of tests: unit, functional, end-to-end, integration, etc...The NG in TestNG stands for Next Generation. TestNG requires JDK7 or higher.Reference: http://testng.org/doc/index.htmlContinue reading Getting Started with TestNG