Inner Classes

Hi, This post is about Inner Classes, which could be useful when you are learning Lambda Expressions and Functional Programming in Java 8. Member Inner Class They can access private variables of outer class. public class MemberInnerClass { private int outer = 5; class Inner { private int inner = 10; public void print() { […]

Class Initialization

Today, I will briefly mention about the class initialization. When we execute any java program (e.g.: java InitTest), Java Virtual Machine loads and link the class, execute initializers, and invokes the main class. Initialization process has some rules. Before we go into the details, spend a few minutes to figure out the output. class SuperClass { static { System.out.print(“0 […]

How to deal with nested conditionals (Part 2)

In my previous post, I mentioned about Decomposing Conditional and Consolidate Conditional Expression for nested conditionals. The problem was not only the nested conditions but also duplicated code fragments and lots of null object controls.  In this post, we will cover Consolidate Duplicate Conditional Fragments and Testing Interface to tackle the above mentioned problems. Consolidate Duplicate Conditional Fragments […]

How to deal with nested conditionals (Part 1)

In my current project, there are 1000s of lines of code (LOC), some of which date back to 10 years ago. An important part of my day-to-day job is try to understand and debug functions just like the following example (Listing 1). I omitted the boolean expressions and the code in branches but it is still […]